2
我有一個自定義指令,稱爲my-directive,屬於屬性類型(restrict:'A')。我用它如下:AngularJs:如何獲得屬性類型指令的屬性值
<input my-directive="mydvalue"/>
如何獲得指令中的「mydvalue」?
app.directive("myDirective", function(){
return {
restrict: 'A',
link: function(scope, el, attrs, controller) {
//How do i get the mydvalue here.
}
};
});
'attrs.mydvalue' – Chandermani
其實'attrs.myDirective',但這就是主意。 –
對,錯誤對不起: – Chandermani