简体   繁体   English

在asp.net5视图上重复angular2组件

[英]Repeate an angular2 component on an asp.net5 view

I create a rating component and try to use it in an asp.net 5 view inside a foreach like this code: 我创建一个评分组件,并尝试在aseach.net 5视图中的foreach使用它,例如以下代码:

 @foreach (var item in Model.Items)
            {
                <my-rating> </my-rating>
            }

my issue is that the component only instantiated one time for first item of the list. 我的问题是该组件仅针对列表的第一项实例化了一次。

Thank to any guidance. 感谢任何指导。

I think that you should have a look at the corresponding code in your browser. 我认为您应该在浏览器中查看相应的代码。 I mean: do you have several <my-rating></my-rating> in your browser using for example the Element tab of Chrome dev tools. 我的意思是:您使用例如Chrome开发者工具的“元素”标签在浏览器中有几个<my-rating></my-rating>吗?

Hope it helps you, Thierry 希望对您有帮助,蒂埃里

在angular2中,每页只能boostrap一个应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM