Reputation: 2023
I have a component which has templateURL. Based on the service true or false it should load. for example first time it service with variable load = true, so templateURL should load. Next time I will set load=false. After this if I call the component again templateURL should not load. How can I achieve this. I want HTML should be remain same in second click, instead of reintialize.
Upvotes: 1
Views: 411
Reputation: 486
Maybe you can show/hide your html div based on variable load.
Supposing you have html file named mycomponent.html
in templateUrl
@Component({
templateUrl: './mycomponent.html'
})
Your html file should be something like this
<div *ngIf="load">
...
</div>
Upvotes: 1