Problem with OnsSelect and Angular5



  • I am using onsen with Angular 5. When I try to use the ons-select, I get an error on initialization where “ons is not defined”. It is occuring in the ons-select.js code line 51 “ons._contentReady(this._element, function() { _this._element.value = obj; });”. This causes the ons-select to not update the ngModel.

    Thanks,

    Aaron



  • I investigated further and found the solution. Hopefully one of the onsen.io folks will see this…

    Edit onsenui.js in the onsenui package and add _contentReady to the ons$1
    variable, i.e.

    var ons$1 = {
      animit: Animit,
      defaultPageLoader: defaultPageLoader,
      elements: onsElements,_
      GestureDetector: GestureDetector,
      modifier: modifier,
      notification: notification,
      orientation: orientation,
      pageAttributeExpression: pageAttributeExpression,
      PageLoader: PageLoader,
      platform: platform,
      softwareKeyboard: softwareKeyboard,
      _autoStyle: autoStyle,
      _internal: internal$1,
      _readyLock: new DoorLock(),
      _util: util,
      _contentReady: contentReady // this was added
    };
    

    BTW, thanks for a great product. I like how it can be easily used for a website.


Log in to reply