How To Load Conditionally Templateurl Html File In Angular 5 Component
There is one scenario in my project, Consider, I have one testDynamic component @Component({ templateUrl: './test-dynamic.html', // Need to override this file styleUrls: ['
Solution 1:
refer the following link, this is a good example of dynamic templateUrl
Solution 2:
You can't add more than one HTML file.
What you can do is, use *ngIf or *ngSwitchCase to show only parts of the template if that is your intention. Then you have only one template html file.
Then html of your template will be something like this:
<div *ngIf="YOUR_CONDITION">View 01</div><div *ngIf="YOUR_CONDITION">View 02</div>
Post a Comment for "How To Load Conditionally Templateurl Html File In Angular 5 Component"