在ngModelController例如角文件,JavaScript文件說:AngularJS ngModelController基本問題
angular.module('customControl', []).
directive('contenteditable', function() {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
...
爲什麼 「ngModel」 是指NgModelController?爲什麼不是這樣呢,「require:'?ngModelController」從命名的角度來看,這似乎更合適。
另外,使用$ setViewValue()函數來更新模型,而不是使用$ watch()函數來監視指令範圍內的模型更改之間有什麼區別?
謝謝!
,因爲它是一個命名約定,你需要學習它們的時期,它與噴油器有關 – mpm