angular.js - Angularjs通过父控制器向子控制器共享方法,中间通过路由,是否会严重影响性能
我想大声告诉你
我想大声告诉你 2017-05-15 17:12:51
0
1
581

因为项目中各个router的controller中有很多重复的$scope.getName方法声明,想像下面描述一样把这些公共的部分放在路由外的controller里面。

<p  ng-controller="parentController">
    <p ui-view></p>
</p>

假设parentController中有一个方法叫$scope.getName;
而路由中配置的有个childController,此时在childController直接运行$scope.getName(person.name),是否会影响页面性能。

我想大声告诉你
我想大声告诉你

reply all(1)
淡淡烟草味

There is a way to provide services in angular to achieve shared methods and reuse

I have never practiced on performance issues, so I dare not speak nonsense.
I feel like writing code like this is not easy to maintain

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