Last active
August 30, 2018 18:34
-
-
Save GCheung55/914dbf8547bdeaa24891b04f54df3810 to your computer and use it in GitHub Desktop.
Demonstrate setting value on service when query param 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'; | |
import { inject as service } from '@ember/service'; | |
import { alias } from '@ember/object/computed'; | |
export default Ember.Controller.extend({ | |
mobileView: service(), | |
appName: 'Ember Twiddle', | |
queryParams: [ 'webview' ], | |
webview: alias('mobileView.isWebview'), | |
actions: { | |
toggleWebview() { | |
this.toggleProperty('webview'); | |
} | |
} | |
}); |
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 { readOnly } from '@ember/object/computed'; | |
import { computed, get, set } from '@ember/object'; | |
export default Ember.Service.extend({ | |
isWebview: false | |
}); |
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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment