Monaca Onsen UI Discord Chat Github Repo

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.

  • administrators

    You can get your app to always using iOS styling by calling from your main app component.

    First import onsenui with:

    import * as ons from 'onsenui';

    Then call in the constructor:

    export class MyApp {
      constructor() {'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.‘ios’);