Javascript Don';t从角度指令显示包装器
我有一个角度指示。当我在页面上调用它时,它仍然显示外部包装。我怎样才能去掉这个包装纸 directions.jsJavascript Don';t从角度指令显示包装器,javascript,angularjs,Javascript,Angularjs,我有一个角度指示。当我在页面上调用它时,它仍然显示外部包装。我怎样才能去掉这个包装纸 directions.js myApp.directive('myThingy', function(){ return { template: "<div>HELLO!</div>" } }); myApp.directive('myThingy',function(){ 返回{ 模板:“你好!” } }); my_page.html <html>
myApp.directive('myThingy', function(){
return {
template: "<div>HELLO!</div>"
}
});
myApp.directive('myThingy',function(){
返回{
模板:“你好!”
}
});
my_page.html
<html>
<body>
<my-thingy></my-thingy>
</body>
</html>
浏览器中的DOM:
<html>
<body>
<my-thingy>
<div>HELLO!</div>
</my-thingy>
</body>
</html>
<html>
<body>
<div>HELLO!</div>
</body>
</html>
你好
如何去掉那些
标记,只显示指令的结果
所需的DOM(没有my thingy标记):
<html>
<body>
<my-thingy>
<div>HELLO!</div>
</my-thingy>
</body>
</html>
<html>
<body>
<div>HELLO!</div>
</body>
</html>
你好
添加选项替换
myApp.directive('myThingy', function(){
return {
replace: true,
template: "<div>HELLO!</div>"
}
});
myApp.directive('myThingy',function(){
返回{
替换:正确,
模板:“你好!”
}
});