Is it possible to have multiple directives on the same HTML element?

。_饼干妹妹 提交于 2019-12-08 05:48:09

问题


Is it possible to have two different directives on the same HTML element?

<div directiveone directivetwo></div>

or will that cause scope issues?


回答1:


Yes you can and it's fairly common. The only potential issue with scope is you can't have multiple new scopes on the same element. Per the angular docs: "If multiple directives on the same element request a new scope, only one new scope is created." http://docs.angularjs.org/guide/directive



来源:https://stackoverflow.com/questions/19352649/is-it-possible-to-have-multiple-directives-on-the-same-html-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!