Skip to content

Instantly share code, notes, and snippets.

@gregtap
Created October 27, 2015 01:33
Show Gist options
  • Select an option

  • Save gregtap/9ed763e20dcab12caf04 to your computer and use it in GitHub Desktop.

Select an option

Save gregtap/9ed763e20dcab12caf04 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'nav',
isMenuVisible: false,
actions: {
toggleMenu: function() {
this.toggleProperty('isMenuVisible');
this.core.set('isMenuVisible', isMenuVisible);
},
},
});
Uncaught ReferenceError: isMenuVisible is not defined
this.core.get('isMenuVisible') is undefined.
What I want to do here is having distinct components to react and listen to `isMenuVisible` data change.
import Ember from 'ember';
// App level variables.
var core = Ember.Object.extend({
isMenuVisibile: false,
});
export function initialize(application) {
// register factory for dependency injection.
application.register('core:variables', core, {singleton: true});
// Inject our factory in all `controller` and `components`.
application.inject('component', 'core', 'core:variables');
}
export default {
name: 'application',
initialize: initialize,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment