부모로부터 자식 요소 안에 'c'속성을 가져와야합니다 (jsfiddle 참조) 가능합니까?부모 범위 속성을 바인딩하는 방법은 무엇입니까?
<div ng-app="myApp">
<box c="yellow">
<item>item</item>
</box>
</div>
angular.module('myApp', [])
.directive('box', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
template: '<div ng-transclude></div>'
};
})
.directive('item', function() {
return {
restrict: 'E',
replace: true,
scope: {c:'='},
template: '<div>c:{{c}}</div>'
};
});
링크 기능과 액세스 범위를 재정의하려고합니다. –