Created
September 21, 2018 22:18
-
-
Save ksurendra/beee65410b2bfa176e821b4f349bbdf3 to your computer and use it in GitHub Desktop.
Complete Angular Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Azureblob { | |
blobName: string; | |
blobURL: string; | |
blboMimeType: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Pipe({ | |
name: 'keys' | |
}) | |
export class KeysPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
return Object.keys(value); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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