angular.js - How to adjust the background interface and synchronize the returned data to the service on the scope? ~
PHPz
PHPz 2017-05-15 17:12:07
0
2
903

The interface can only be adjusted once. This makes it easy to use the service singleton feature. However, how to synchronize it to the scope? Define a method to return data. But the acquisition is asynchronous. When the method is called, the data may not be obtained. There is another problem. The first method is to pass the scope parameter into the service and update the scope asynchronously. But it seems that this is not recommended... Looking for a solution~

PHPz
PHPz

学习是最好的投资!

reply all(2)
曾经蜡笔没有小新

I can understand that you need to synchronize, that is, wait for the data to be obtained before calling the method

angular’s ​​promise should be what you want

Post an article at the address:
/a/11...

仅有的幸福

The service layer is only used to request interfaces, and callbacks and data operations are done in the controller

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template