0
Plunker:http://plnkr.co/edit/XBJjr6uR1rMAg3Ng7DiJ?p=preview爲什麼類和註釋指令沒有綁定?
我希望這兩個看起來相同:
<span dt-attrib="{{person.name}}">This won't be here</span><br/>
<span class="dt-class: {{person.name}};">This won't be here.</span> - this does not process
但是,這是我所得到的:
This text was set by the dtAttrib directive, value="Burt Finklestein"
This text was set by the dtClass directive, value="{{person.name}}"
代碼:
app.directive("dtAttrib", function() {
return {
restrict: "A",
link: function(scope, element, attrs) {
element.text('This text was set by the dtAttrib directive' + DisplayValueString(attrs.dtAttrib));
}
}
}
});
app.directive("dtClass", function() {
return {
restrict: "C",
link: function(scope, element, attrs) {
element.text('This text was set by the dtClass directive' + DisplayValueString(attrs.dtClass));
}
};
});