Last active
August 14, 2016 20:13
-
-
Save kumkanillam/68d59ce5a4293d6f90112de6d9a13805 to your computer and use it in GitHub Desktop.
Observing Controller Property in Service
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 {computed,observer} = Ember; | |
export default Ember.Controller.extend({ | |
myService:Ember.inject.service(), | |
appName: 'Ember Twiddle', | |
changedAppName:observer('appName',function(){ | |
this.get('myService').changeAppName(this.get('appName')); | |
}), | |
actions:{ | |
changeApp(){ | |
this.set('appName','Kumkanillam'); | |
} | |
} | |
}); |
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.Service.extend({ | |
appName:'SSS', | |
changeAppName(param){ | |
this.set('appName',param); | |
} | |
}); |
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.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