Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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’);