Last active
October 17, 2016 17:16
-
-
Save miguelcobain/a3cbc636d49664b9f4d5a6e2687e7987 to your computer and use it in GitHub Desktop.
volatile changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Controller, inject, computed, observer } = Ember; | |
export default Controller.extend({ | |
post: inject.controller('blog/post'), | |
selectedPostTitleDidChange: observer('post.model.cp', function() { | |
console.log('a'); | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { Controller, Object: EmObject, computed } = Ember; | |
const PostModel = EmObject.extend({ | |
cp: computed('title', { | |
get() { | |
return this.get('title').toUpperCase(); | |
}, | |
set(k, v) { | |
this.set('title', v.toLowerCase()); | |
return v.toUpperCase(); | |
} | |
}).volatile() | |
}); | |
export default Controller.extend({ | |
model: PostModel.create({ | |
title: 'A blog Post' | |
}), | |
actions: { | |
changeTitle() { | |
this.set('model.cp', 'A New Title'); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('blog', function() { | |
this.route('post'); | |
}); | |
}); | |
export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"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.1.2", | |
"ember-data": "2.0.1", | |
"ember-template-compiler": "2.1.2", | |
"ember-testing": "2.1.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment