I encountered a problem with clashing directive and attribute names. This is a simplified version of my problem: there are two directives, where the name of the first directive is an attribute name of the second directive:
angular.module('mymodule').directive('property', function() {
return {
template: '<div>Property Directive</div>'
};
});
angular.module('mymodule').directive('fail', function() {
return {
scope: {
property: '='
},
template: '<div>{{property}}</div>'
}
});
When I try to add my second directive to an html file:
<fail property="'test'"></fail>
I get the following error:
Error: [$compile:multidir] Multiple directives [fail, property] asking for template on: <fail property="'test'">http://errors.angularjs.org/1.3.0-rc.4/$compile/multidir?p0=fail&p1=property&p2=template&p3=%3Cfail%20property%3D%22'test'%22%3E
Now, this wouldn't be a problem if both directives were in my modules, since renaming them would be easy. But I have clashing directive/attribute names from different external modules that I use in my application.
How can I tell angular, that the attribute property
is not meant to be a directive in this particular case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…