How to call disableAutoStyling() in angular2 onsen framework
-
I am new to angular2 and onsen ui framework. I want to use IOS style in both Android and IOS devices. I can see examples to call ons.disableAutoStyling() in JS to force devices to use IOS style. But I am not able to call this function in Angular2. Its giving error. I also tried (<Element>document.querySelector(‘ons’)).disableAutoStyling() but same error.
Could you please help me here.
-
You can get your app to always using iOS styling by calling
ons.platform.select
from your main app component.First import onsenui with:
import * as ons from 'onsenui';
Then call
ons.platform.select
in the constructor:export class MyApp { constructor() { ons.platform.select('ios'); }
Please let us know if that doesn’t solve your problem.
-
Thanks a lot @emccorson. With our suggestions I was able to fix the issue. Below is the working code in angular 7.
one.onsPlatform.select(‘ios’);