Skip to content

Instantly share code, notes, and snippets.

@evanphx
Last active February 10, 2016 00:09
Show Gist options
  • Save evanphx/019c90db10078f24688f to your computer and use it in GitHub Desktop.
Save evanphx/019c90db10078f24688f to your computer and use it in GitHub Desktop.
Ember observer
import Ember from 'ember';
export default Ember.Component.extend({
organizations: Ember.inject.service("organizations"),
activeOrgChange: Ember.observer("organizations.active", function() {
var name = this.get("organizations.active.name");
useName(name);
}
})
});
import Ember from 'ember';
export default Ember.Service.extend({
active: null,
activePage: null,
displayTopBarNav: false,
});
import Ember from 'ember';
export default Ember.Route.extend({
organizations: Ember.inject.service("organizations"),
model(params) {
let organizations = this.get("session.currentAccount.allOrganizations");
let organization = organizations.findBy('id', params.id);
return organization;
},
afterModel: function(model) {
this.set("organizations.active", model);
this.get("organizations.active");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment