NIGHTLY: enyo.ModelController error

edited October 2013 in Enyo 2.4
My code was working before the last nightly build, but today, but now:

Object .app.$.currentCategory has no method 'addObserver'. .app.$.currentCategory is an enyo.ModelController.

Any ideas about this?

Comments

  • In my test, I definitely saw that enyo.ModelController instances have the addObserver method. Are you sure that the currentCategory component is being created properly? Are you trying to access it before the create() method of the app has been called?
  • Well, it was working yesterday, so I suppose that is being created properly. Maybe the problem comes with being called before the app is created, but it should've failed yesterday too...

    Dunno. Anyways, I was thinking about removing that modelController, probably creating a selectedModel property in my collection and bind the the related kinds to it.

    What do you kind about this approach?
  • edited October 2013
    This is strange, as I'm not doing anything special with it:

    It's on my application's components array, and it's just being in the model's propery of a component. It 's not prefilled with any model, and it breaks on app's startup.

    But if I put it inside the component, as a binding, everything works as expected, so
    components: [{
         kind: "myKind",
         model: ".app.$.currentCategory
    }]
    breaks the app, but
    components: [{
         kind: "myKind",
         bindingDefaults: {
               from: ".app.$.currentCategory",
               to: ".model"
         }
    }]
    enyo.kind({
         name: "myKind",
         bindingDefaults: {
               from: ".app.$.currentCategory",
               to: ".model"
         }
    });
    Works.

    Previously the first try used to work too.
  • You are missing a quotation mark in the first try. *shrug*
  • Yeah, but that's bit a copy-paste from the code, or the error would've been " "myKind" is not the name of a valid kind"
  • edited October 2013
    Ah, see the Changelog.md file:
    Removed the modelChanged() and deprecated controllerChanged() base methods from enyo.UiComponent thus any developer code currently calling this.inherited(arguments) from within an overloaded modelChanged() method will fail and needs to be removed. This is a feature change required by ENYO-3339.
    which decodes to special string resolution support for the model property is gone.
  • Ops, I left the Changelog.md unchecked in my to-do list... My fault.
Sign In or Register to comment.