在角中,我知道如何创建具有以下语法的自定义指令:
元素指令
<my-custom-element attr1 = "some stuff"> </my-custom-element>属性指令
<div my-custom-attribute> </div>我想做什么
<div my-custom-attribute = "some value"> </div>这个是可能的吗?
如果是这样的话,是怎么做的?我希望有一个极简主义的例子。
谢谢
发布于 2017-05-09 14:21:17
你可以两个人同名,
app.directive('myCustomAttribute', function() {
return {
restrict: 'A',
scope: {
myCustomAttribute: '='
},
templateUrl: '...'
};
});它可以用作,
<div my-custom-attribute="somevalue"></div>https://stackoverflow.com/questions/43872282
复制相似问题