Skip to content

Instantly share code, notes, and snippets.

@loadx
Created November 10, 2017 08:39
Show Gist options
  • Save loadx/d788f305557762f7400c92fa77304e00 to your computer and use it in GitHub Desktop.
Save loadx/d788f305557762f7400c92fa77304e00 to your computer and use it in GitHub Desktop.
test-service-binding
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('flip')
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
session: Ember.inject.service(),
model(){
this.get('session').set('testing', true);
}
});
import Ember from 'ember';
export default Ember.Service.extend({
testing: false
});
The value of testing is: {{if session.testing "yep" "nope"}}
{{#link-to "flip"}}Flip value{{/link-to}}
{{outlet}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "release",
"ember-template-compiler": "release",
"ember-testing": "release"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment