Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Switching Platforms With Ionic Serve

DZone's Guide to

Switching Platforms With Ionic Serve

When using Ionic Serve, your project fires up in Chrome, but by default, it uses the iOS CSS styles. Learn how to use Serve in Android.

· Mobile Zone ·
Free Resource

Yesterday a question came up in an Ionic session I was attending involving ionic serve and platforms. When you use ionic serve, it will fire up the project in your Chrome browser. You may not be aware of it, but by default it uses the iOS CSS styles. This becomes more obvious when you use the lab option. Here is the tabs template by itself:

shot1

And here it is with the lab option – you can now see that the iOS one was used by default.

shot2

Ok, so the question was – how do you ionic serve to just Android? Turns out, you can use the platform attribute with ionic serve. This was added ([Request] ionic serve –platform=”android”) back in May. Simply do ionic serve --platform android:

shot3

In case you’re curious, this works without needing to actually add the Android platform. (And on the flip side, if you don’t have iOS, the default behavior for ionic serve is to still show the iOS CSS.)

Topics:
mobile ,ionic serve ,ios ,android

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}