Skip to content

Instantly share code, notes, and snippets.

@phillipkregg
Last active August 1, 2016 14:32
Show Gist options
  • Select an option

  • Save phillipkregg/85ab6637e4ced58f928e6a32b9c1df7a to your computer and use it in GitHub Desktop.

Select an option

Save phillipkregg/85ab6637e4ced58f928e6a32b9c1df7a to your computer and use it in GitHub Desktop.
Model Change
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
newProperty: undefined,
actions: {
changeProperty: function() {
this.send('changeModel', this.get('newProperty'));
}
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return Ember.Object.create({
test: 'test'
})
},
actions: {
changeModel: function(newValue) {
debugger;
this.modelFor('index').set('test', newValue);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
<h2>Index</h2>
{{input value=newProperty}}
<button {{action 'changeProperty'}}>Change Model</button>
<h4>{{model.test}}</h4>
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment