
以上圈出的事上面意思呢?比如:require:‘ng-model’ 是不是和下面的对应?
<div>
<div contentEditable="true" ng-model="content" title="Click to edit">Hello</div>
<pre>model = {{content}}</pre>
</div>图中圈红1:指令中,require 属性,代表这个指令要引用的ctrl(请求另外的controller)。这里是用了ngModelCtrl(内置),也可自定义指令。
圈红2、3:用require引入了ctrl(ngModelCtrl),即可调用该ctrl的方法。如$setViewValue()..源码中可见。
ps:可结合书与教程进行学习,遇到不懂多利用搜索引擎。
祝好。