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,
Aurelien

To reuse as much as possible, i would go with http://ionicframework.com/docs/api/components/grid/Grid/
or use a global variable, that depends on
this.platform.is('mobile')
or something similar: http://ionicframework.com/docs/api/platform/Platform/
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.


1 Like