L
L
lssssssssssl2021-09-18 06:01:02
Angular
lssssssssssl, 2021-09-18 06:01:02

How to render components using *ngFor?

Let's say I have an array that contains some information about the components. When iterating over this array, I need to display these components based on its data.
I tried via:

arr = [{name: 'example'}]
<router-outlet name="{{arr.name}}"><router-outlet>
{path: '', outlet: 'example', component: ExampleComponent}


But angular forbids doing such a construction name="{{arr.name}}"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2021-09-18
@mmmaaak

This is not forbidden by angular, but by javascript, since the arr array does not have a name property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question