mokahaiku
mokahaiku

Reputation: 251

Ionic: same style for android and iOS

In this video (https://www.youtube.com/watch?v=ZjPRj2Vp74U) Andrew mentions that Ionic builds different element design for each platform. Is it possible to prevent that, so the app looks the same on all platforms?

Upvotes: 15

Views: 6683

Answers (4)

0x1ad2
0x1ad2

Reputation: 8062

For Ionic 2.0.0 you can use the config parameter of the IonicModule forRoot method.

IonicModule.forRoot(MyApp, {mode: 'ios'}),

Upvotes: 15

ProllyGeek
ProllyGeek

Reputation: 15836

The ionic.Platform utility can be used in your JavaScript controller to set the platform for your app.

Actually it can set and get the platform, the trick is to run the set command in the run method for your module before everything else is set:

angular.module('YourAppName').run(function () {
    //override platform
    ionic.Platform.setPlatform("android");//all styles will be unified on both Android and iOS 


});

Upvotes: 2

Sebastián Lara
Sebastián Lara

Reputation: 5541

If you are using Ionic2...

open app/app.ts

and add the next config:

ionicBootstrap(MyApp, [], {
  mode: 'ios' // use 'md' for android and 'wp' for windows 
})

Upvotes: 8

Sani Yusuf
Sani Yusuf

Reputation: 982

Yes this is 100% possible.

This can be achieved with the Ionic $ionicConfigProvider. You can use this provider within your .config() method and do things like override which platform specific styles you want to.

Its a pretty powerful tool. Have a look at the docs for full info.

Upvotes: 8

Related Questions