Switching platforms with Ionic Serve

This post is more than 2 years old.

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

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Justin James posted on 9/28/2015 at 9:18 PM

Too funny that you blogged on this today as I just found and used this command yesterday.

Comment 2 (In reply to #1) by Raymond Camden posted on 9/29/2015 at 1:25 PM

I credit the person who asked the question in class. :)