Tuesday, 21 October 2014

how to call restful back end by angularjs


1 to send http request, and the template to handle the success event and error event:

    the advantage of this method is invoker need support a callback function, which is highly coupled.




2 still in service, but this is a new method to call http without coupling. (by $q defer)

          this is the service likes:



              this is the service caller likes:






                after angularjs 1.2, this caller should be written like this: (by $promise)




3 by using $resource to call restful backend:
























































No comments:

Post a comment