Skip to content

Instantly share code, notes, and snippets.

@ksurendra
Created September 21, 2018 22:18
Show Gist options
  • Save ksurendra/beee65410b2bfa176e821b4f349bbdf3 to your computer and use it in GitHub Desktop.
Save ksurendra/beee65410b2bfa176e821b4f349bbdf3 to your computer and use it in GitHub Desktop.
Complete Angular Example
<div class="row">
<div class="col-md-4" *ngFor="let key of blobsList | keys">
<p><img src="{{blobsList[key].blobURL}}" height="100" width="100"></p>
<p><a class="btn btn-default" href="#">{{blobsList[key].blobName}}</a></p>
</div>
</div>
getAllBlobs() : void {
this.azureblobService.getAllBlobs()
.subscribe(
(val) => {
console.log("POST call successful value returned in body",
val);
this.blobsList = val; //<====== Set value here
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
}
export class Azureblob {
blobName: string;
blobURL: string;
blboMimeType: string;
}
@Pipe({
name: 'keys'
})
export class KeysPipe implements PipeTransform {
transform(value: any, args?: any): any {
return Object.keys(value);
}
}
getAllBlobs() {
console.log("....AzureblobService.getAllBlobs()");
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Accept' : 'application/json'
});
return this.http.post<Azureblob[]>(this.serverUrl,
JSON.stringify({
"azureAcountName": "acsazurestore",
"azureAcountKey": "qjC6s44AmSbAkJ7Xqdsks/jjZDIYRTY8qgWKds8w8PXdL+Q08mU/yu3Oh/4wO3sYTwNgNiA6EG66gBRWBqMBNA==",
"azureContainer":"acsazurecontainer",
}),{headers: headers});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment