简体   繁体   English

AngularJS-监视指令的控制器范围

[英]AngularJS - watching the scope of directive's controller

I've built a plunker to test things out, but I must not be understanding some angular fundamentals. 我已经制作了一个测试用的插件,但是我一定不能理解一些棱角分明的基本原理。

Why is the directive's link function not able to watch a property (scope.featureAttributes) on the directive's controller's scope. 指令的链接函数为什么不能在指令的控制器作用域上监视属性(scope.featureAttributes)。

http://plnkr.co/edit/rWG5NEp6TRYfP7l1HHDw http://plnkr.co/edit/rWG5NEp6TRYfP7l1HHDw

thanks for your help 谢谢你的帮助

You use $watchCollection . 您使用$watchCollection The plnkr includes Angular 1.0.8. plnkr包含Angular 1.0.8。 $watchCollection was introduced in a later version. $watchCollection在更高版本中引入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM