Skip to content

Instantly share code, notes, and snippets.

@siva-sundar
Last active December 10, 2015 14:36
Show Gist options
  • Save siva-sundar/bb759103e456bbfcde02 to your computer and use it in GitHub Desktop.
Save siva-sundar/bb759103e456bbfcde02 to your computer and use it in GitHub Desktop.
toString()
var t = { contact: 'John',
toString: function() {
return this.contact;
}
};
export default Ember.Controller.extend({
name: t,
actions: {
update() {
var name = this.get('name');
Em.set(name, 'contact', name.contact + '--');
this.set('name', name);
console.log(this.get('name'));
`check your console`
}}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{name}}
<button {{action 'update'}}> update name </button>
{{outlet}}
<br>
<br>
{
"version": "0.4.17",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment