Skip to content

Instantly share code, notes, and snippets.

@ofridagan
Last active May 2, 2016 07:30
Show Gist options
  • Save ofridagan/e04223913973e3dc47deed3c52c8155f to your computer and use it in GitHub Desktop.
Save ofridagan/e04223913973e3dc47deed3c52c8155f to your computer and use it in GitHub Desktop.
NotifyChange
import Ember from 'ember';
export default Ember.Controller.extend({
needs: ['inner'],
appName: 'Ember Twiddle',
someProperty: {counter: 0},
changeProperty: Ember.on('init', function() {
let that = this;
setInterval(function() {
that.incrementProperty('someProperty.counter');
that.notifyPropertyChange('someProperty');
}, 1000);
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
needs: ['application'],
pointer: Ember.computed.alias('controllers.application.someProperty'),
aaa: {},
alerting: (function() {
console.log("A");
}).observes('pointer').on('init')
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none'
});
Router.map(function() {
this.route('inner');
});
export default Router;
<h1>Welcome to {{appName}}</h1>
<br>
{{someProperty.counter}}
<br>
{{outlet}}
<br>
<br>
{
"version": "0.7.2",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.13",
"ember-data": "1.13.15",
"ember-template-compiler": "1.13.13"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment