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~
曾经蜡笔没有小新2017-05-15 17:14:07
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...
仅有的幸福2017-05-15 17:14:07
The service layer is only used to request interfaces, and callbacks and data operations are done in the controller