是否有可能有相同的HTML元素的多个指令? [英] Is it possible to have multiple directives on the same HTML element?

查看:236
本文介绍了是否有可能有相同的HTML元素的多个指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能具有相同的HTML元素的两种不同的指令?

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

< D​​IV directiveone directivetwo>< / DIV>

或将这一事业范围的问题?

or will that cause scope issues?

推荐答案

当然可以,这是相当普遍的。与范围的唯一潜在的问题是你不能有相同的元素上的多个新领域。每角文档:如果在相同的元素的多个指令要求一个新的范围,只创建一个新的范围。 http://docs.angularjs.org/guide/directive

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

这篇关于是否有可能有相同的HTML元素的多个指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆