基本的に、作成したディレクティブの親スコープにアクセスできるようにしたいのですが、要素に配置した属性にもアクセスできるようにしたいと考えています。
たとえば、関連するjs
app.directive('testDirective', function(){
return {
restrict:"E",
templateUrl:"directive.html",
scope:{
testAttribute: '='
}
};
});
app.controller('mainCtrl', function($scope){
$scope.name = 'henry'
}
index.html
<div ng-controller="mainCtrl">
<test-directive test-attribute="Hello"></test-directive>
</div>
ディレクティブ.html
{{testAttribute}}
{{name}}
「Hello Henry」ではなく「Hello」が出力される
明確にするために、私ができるようにしたいのは、属性と親スコープにアクセスすることだけです。