I want to realize dynamic tabs.So I need create many and The number is uncertain.In angular2, I find this solution .When I use Angular4 , it doesn't work. How can I do this?
Asked
Active
Viewed 1,546 times
1
-
`code
-
Why would you need differently named router-outlets for a tab component with dynamic tabs? – Günter Zöchbauer Aug 24 '17 at 09:42
-
I want to diferent content for difrent tabs. just like this question https://github.com/angular/angular/issues/17173 – feibabm Aug 24 '17 at 10:06
-
I get that, but you always only show a single tab, therefore you can display every tab content in the same router-outlet, even when it's different content. – Günter Zöchbauer Aug 24 '17 at 10:07
-
As you say, I swith tabs. But when I come back to the pre tab, the content must reload. This is not a result I want. – feibabm Aug 24 '17 at 10:36
-
You can implement a custom reuse-strategy, so components don't get destroyed and re-created. – Günter Zöchbauer Aug 24 '17 at 10:40
1 Answers
2
-
Here is another solution.https://juristr.com/blog/2017/07/ng2-dynamic-tab-component/ – feibabm Aug 29 '17 at 08:33