AngularJS: Creating Objects that map to REST Resources (ORM-Style)

前端 未结 7 564
南笙
南笙 2021-01-29 18:09

I\'m pretty new to AngularJS, but I\'m pretty unclear on how to tie it up to my Server\'s REST Api backend.

For example, say I have an \"image\" resource that I get by G

7条回答
  •  北海茫月
    2021-01-29 18:37

    I'm creator of Restangular so my opinion can be biased.

    But as Bob said, you can use Restangular for it.

    Restangular uses your Restful API Resources to go over the tree. You can also add new methods to this.

    This is coding example: https://github.com/mgonto/restangular#lets-code

    And this way you can add new methods to your object (The bonus points :)) https://github.com/mgonto/restangular#creating-new-restangular-methods

    Hope this works out for you :).

    Otherwise, you can also use ngResource ($resource) for this but in my opinion, it needs some "love" and "sugar".

    Bests

提交回复
热议问题