javascript - ng2中的占位符怎么去掉呢
本文介绍了javascript - ng2中的占位符怎么去掉呢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
1.页面中的占位符,比如<my-app></my-app>怎么在页面渲染后消掉
解决方案
这种写法去不掉的,replace属性已经被去掉了,看这个issue。
解决这个问题的办法是在组件当中使用属性来替代你这种写法:
js中定义:
selector: '[myComponent]'
html中使用:
<div myComponent>Hello My component</div>
参考链接:
Remove the host HTML element selectors created by angular component
How to remove/replace the angular2 component's selector tag from HTML
这篇关于javascript - ng2中的占位符怎么去掉呢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文