angularj js:html模板插入:在每次插入时修改属性值
你好,堆栈溢出社区! 这是我的代码的迷你版。在中,我试图在index.html中的每个div中插入模板,并在每次插入时更改其id。 +为什么h1元素会消失angularj js:html模板插入:在每次插入时修改属性值,html,angularjs,templates,insert,attributes,Html,Angularjs,Templates,Insert,Attributes,你好,堆栈溢出社区! 这是我的代码的迷你版。在中,我试图在index.html中的每个div中插入模板,并在每次插入时更改其id。 +为什么h1元素会消失 <div id= "simpleSearchType OR advancedSearchType OR expertSearchType" > this is the div to be inserted </div > 这是要插入的div 感谢您的帮助。一种更简单的方法是使用ng if指令 您
<div id= "simpleSearchType OR advancedSearchType OR expertSearchType" >
this is the div to be inserted
</div >
这是要插入的div
感谢您的帮助。一种更简单的方法是使用
ng if
指令
您可以在控制器中设置searchType
变量,并通过将div挂接到ng(如果
),在模板上适当地切换视图