lundi 6 juillet 2015

Ember Mixin undefined in controller

May be a silly question, but can't seem to get this right. I have some actions that I'd like to share across two controllers, so I'd like to define them in a mixin and then include them in the controllers. My syntax matches what I've seen in the guides:

mixins/shared.js.coffee

App.Shared = Ember.Mixin.create
  actions:
    showTab: (tab) ->
      //handle action here

controllers/messages/messages_contacts_show_controller.js.coffee

Dashboard.MessagesContactsShowController = Ember.ObjectController.extend Dashboard.Shared,

Upon loading the app, I have this error:

Uncaught Error: Assertion Failed: Expected hash or Mixin instance, got [object Undefined] 

I'm not sure how to load this mixin before the controller since my files are separate (ref: what is the correct way to use coffeescript with ember´s Mixins?'ve tried importing it but keep getting "reserved word" errors from coffeescript.

`import { Shared } from './mixins/shared' `

and

`import Shared from "./mixins/shared" ` 

What's the proper way to get a mixin to load before the controllers it will be used in??

I'm using Ember 1.8.1




Aucun commentaire:

Enregistrer un commentaire