angular.js - Can the data stored in the angularJS service interact directly with the HTML page?
为情所困
为情所困 2017-05-15 17:01:27
0
2
577

Is it possible to directly display the data in the service on the page without using $scope as an intermediate variable?

为情所困
为情所困

reply all(2)
过去多啦不再A梦

No, it’s not recommended either.
This breaks the layering of MVC.

But in theory you can write a directive implementation specifically for this

为情所困

Page display needs to be controlled by the controller, so the data must pass through the controller and then be presented to the page. On the contrary, you can omit the service, inject $http and $q directly into the controller, and move the service code to the controller. But this function is feasible, but the actual code structure is messed up. So this is not recommended. As for not having a controller, it’s not feasible.

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