简体   繁体   中英

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:

 @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.

Hope it helps you, Thierry

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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