0
.directive('phoneType', [function() {
return {
scope: {
phoneNumber: '=phoneType'
}
link: function (scope, element, attrs) {
// now do stuff with the number, you can access it through the scope
scope.phoneNumber // contains the number
scope.vm.somethingInMyController // vm is undefined
}
};
}])
如何實現這兩個phoneType
和我的指令中vm
變量?角度:如何讓家長和元素範圍,指令
嘗試的console.log範圍。$父。 –