<custom-input-container>
<input ng-model="myModel1" />
</custom-input-container>
<custom-input-container>
<select ng-model="myModel2" >
</select>
</custom-input-container>
内ngModelを見(可能であれば、私はこのディレクティブは「customInput.js」でそれを分離して別のアプリモジュールで使用できるようにしたい)私はこのような何かをしたい、私のディレクティブ
myApp.directive('customInputContainer',function(){
return{
restrict: 'E',
priority: 0,
link:function(scope,element,attr){
scope.watch->//i want to watch the ngModel of
the thing inside <custom-input-container>
then do console.log('recipe was updated:'+thenewvalue);
}
}
});
注:各入力コンテナには入力/選択/テキストエリアのいずれか1つしかありません – anaval
'transclude'とその意味を認識していますか? – AranS
悲しいことに...私は非常にanglejsに新しいです – anaval