<check_address address-id='address.addressId'></check_address> // html
app.directive('checkAddress', ['ajaxFactory', function (ajaxFactory) {
return {
restrict : 'EA',
scope:{
addressId : '='
},
templateUrl: 'address.html',
link: function (scope, elt ,attrs) {
console.log(scope.addressId);
}
};
}]);
无法获取scope.addressId。它显示未定义。但我的价值在于范围。如果有人知道手段请更新。提前谢谢。
答案 0 :(得分:1)
app.directive('test', function(){
return {
restrict: 'A',
scope: {
myId: '@'
},
link: function(scope, iElement, iAttrs) {
iAttrs.$observe('myId', function(value){
alert(value);
});
}
};
});