我想知道是否有办法在 index.html 文件上预先编写“动态”Angular 2 输入和输出,并且嵌入式 Angular 2 应用程序可以与这些元素绑定(bind)?
即index.html
<body>
<my-app>Loading...</my-app>
<div>{{getData}}</div>
<button (click)="onTestGet()">Click me to test get data</button>
</body>
Angular 2 应用程序将在 <my-app>
中呈现的位置标签。
我做了 {{getData}}
当按钮位于 Angular 模板内时,按钮运行良好。但是现在,当它们在 index.html 中时,它们只是愚蠢的元素。
最佳答案
关于javascript - Angular 2 组件可以与 index.html 上的元素交互吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37768700/