title: How to call WebAPI action with AngularJS and TypeScript?
body: <p>I need to call my webAPI actions from AngularJS. I can do simple CRUD but if I want to call specific action, how should I call it?</p>
  
  <p>For example I can call POST by Calling <strong>save</strong> from AngularJS <strong>Resource</strong>.</p>
  
  <p>Here is the TypeScript code I'm using:</p>
  
  <p><a href="http://dotnetbyexample.blogspot.com/2014/07/angularjs-typescript-using-resource-to.html" rel="nofollow">Link to the source of the code</a></p>
  
  <pre><code> /// &lt;reference path="../models/ILogin.ts" /&gt;
  
   module App.Resources {
   "use strict";
  
   export interface ILoginResourceDef
   extends ng.resource.IResource&lt;Models.ILogin&gt; {
   }
  }
  
  
  /// &lt;reference path="ILoginResourceDef.ts" /&gt;
  
   module App.Resources {
  "use strict";
  
  export interface ILoginResource
  extends ng.resource.IResourceClass&lt;Resources.ILoginResourceDef&gt; {
  }
  } 
  
  
  /// &lt;reference path="../models/ILogin.ts" /&gt;
  /// &lt;reference path="../models/Login.ts" /&gt;
  /// &lt;reference path="../resources/ILoginResource.ts" /&gt;
  /// &lt;reference path="../scope/ILoginScope.ts" /&gt;
  
  
  module App.Controllers {
  "use strict";
  
  export class AccountController {
      constructor(private $scope: Scope.ILoginScope, private loginResource: Resources.ILoginResource) {
          $scope.newLogin = new Models.Login();
      }
  
      public login(): void {
          this.loginResource.save(this.$scope.newLogin,  // This save trigger the POST
              () =&gt; this.logme(),
              () =&gt; { alert('failure'); });
      }
  </code></pre>