angular.js - angularJS service里面存储的数据能够直接和HTML页面交互吗?
为情所困
为情所困 2017-05-15 17:01:27
0
2
537

不用$scope做中间变量,直接在页面上展示service里面的数据,可以吗?

为情所困
为情所困

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