SharePoint Pals
 | Sign In
How to use Angular Promise using Typescript await and async (ES6)
by Krishna KV 24 Oct 2016
Team Leader, Aspire Systems
Today  :   12     Total  :    1304

The typescript async and await is a ES6 functionality. It used to allow the developers to write the asynchronous code to flows as a synchronous method, without write a handler or a callback function. The similar pattern was used in C# to make use of the promises.


 class AppService {
     static $inject = ['$http'];
     constructor(private $http: ng.IHttpService) {
     public getBooks() {
         var url = "http://localhost/appservice/api/books";
         return this.$http({
             method: 'GET',
             url: url,
             headers: { "Accept": "application/json; odata=verbose" }


 class App {
     public static  app: ng.IModule
     constructor() {
        = angular.module('app', []);"homeCtrl", Home);'appService', AppService);
 new App();
 class Home {
     public lstBooks: Book[];
     static $inject = ['appService'];
     constructor(private appService: AppService) {
 public async getBooks() {
          await this.appService.getBooks().then(books =>{
              this.lstBooks = <Book[]>;


 <div ng-controller="homeCtrl as vm">
 	<div ng-show="">{{vm.process}}</div>
 		<tr ng-repeat="book in vm.lstBooks">
 	<button ng-click="vm.getBooks()" type="button">Click</button>
blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter November 21, 21:08
Implementing Multi-Threading with MaxDegreeOfParallelism in SharePoint using CSOM – An Insight -

Twitter November 21, 12:48
Configure Windows Firewall for SQL Server Analysis Service (SSAS) -

Twitter November 21, 12:46
Implementing Multi-Threading in SharePoint To Upload Files using CSOM C# – An Insight -

Twitter November 20, 21:48
How to Get the Client Context Using App Access token, by passing Client ID using CSOM in SharePoint Office 365 -

Twitter November 18, 21:30
How to Enable Auto Approval For Permission Requests in Community Site Template – Office 2013 using Client Side Object Model (CSOM) C#

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation