0
上工作,我有這樣的事情:
<my-directive name="form"><div ng-if="form.$submitted"></div></my-directive>
,並在我的指令:
angular.directive('myDirective', function() {
return {
template: '<form name="{{ name }}" ng-transclude></form>',
transclude: true,
scope: {
name: '@'
},
link: function(scope) {
console.log(scope.form.$submitted); //works here
}
}
});
form.$submitted
似乎並不在此定義?但它是在指令範圍內定義的?我如何從HTML訪問form.$submitted
?
謝謝!