Using different Angular templates depending on target app (web vs mobile)


Hi everyone,

We would like to build a mobile App with a rather complex web-based Admin Dashboard and share as much code as possible between them. So we are trying to figure out if Ionic would be a good fit.

My first question would be:

  • is it possible with Ionic to use different Angular templates according to the target (mobile vs web)?

Thanks in advance,


To reuse as much as possible, i would go with
or use a global variable, that depends on'mobile')
or something similar:
and *ngIf in your templates that checks the variable


@Nexi, thank you for the suggestions. This will be useful already.

What I would also like to do is to somehow compartiment parts of the Angular implementation according to a specific target (web vs. mobile) so that only the relevant parts get shipped to the corresponding target?

Is it something that can be done with Ionic?


I know this is possible with NativeScript and Angular. Maybe it is possible to somehow adopt it for ionic.