AngularJS: Using Shared Service(with $resource) to share data between controllers, but how to define callback functions?

前端 未结 4 743
自闭症患者
自闭症患者 2020-12-11 04:45

Note: I also posted this question on the AngularJS mailing list here: https://groups.google.com/forum/#!topic/angular/UC8_pZsdn2U

Hi All,

I\'m building my fi

4条回答
  •  独厮守ぢ
    2020-12-11 05:03

    AngularJS has its own way of caching queries, which you should use. As for the callback, it's no use assigning the query to a variable, since a promise will be returned anyway. You should simply always expect a promise, and pass your callback inside success or finally.

提交回复
热议问题