Ember Mixin undefined in controller

Asked By: Anonymous

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

Dashboard.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


Solution

Answered By: Anonymous

Assuming you require your JS files in some main App script, the problem is most likely that “MessagesContactsShowController” sorts before “Shared”. When you require with a wildcard, the files are included in alpha order. You might try moving your Shared mixin to a different folder and then changing the order of your require statements so it is processed before MessagesContactsShowController


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno