Which is preferable controller or link function in AngularJS directives?

Angular docs said:

Best Practice : use controller when you want to expose an API to other directives. Otherwise use link.

Why should we use link functions if we don't have any APIs to expose from the directive and if there is no data to share between the directives?

链接地址: http://www.djcxy.com/p/77918.html

上一篇: 预先输入时设置输入无效

下一篇: 在AngularJS指令中,哪个是更好的控制器或链接函数?