Switching platforms with Ionic Serve

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:


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


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:


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.)

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.

Want to read more like this?