Reputation: 315
Template for mobile and desktop are very different, but have one logic in component. I need separate template and design for mobile and desktop in separate files. I want include template and design depending on the screen.
Upvotes: 4
Views: 1448
Reputation: 657406
You can use *ngIf
template: `
<div *ngIf="isMobile">
mobile content
</div>
<div *ngIf="!isMobile">
desktop content
</div>
The Angular2 team had an attempt to support this directly using the @View()
decorator but removed it a few versions ago because it didn't seem to be a good strategy. Currently there is no built-in support for what you want.
Upvotes: 2