Last active
July 29, 2016 14:51
-
-
Save phillipkregg/f632cd207f036c1b7b57171c7ffaf2a3 to your computer and use it in GitHub Desktop.
Service Test
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.Component.extend({ | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
templateProperty: attr() | |
}); |
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('another-route'); | |
}); | |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
myService: Ember.inject.service(), | |
model: function() { | |
return this.get('myService') | |
}, | |
actions: { | |
callServiceMethod: function() { | |
debugger; | |
this.get('myService').serviceMethod1(); | |
this.get('myService').changeProp2('changed!'); | |
} | |
} | |
}); |
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.Route.extend({ | |
myService: Ember.inject.service(), | |
model: function() { | |
return this.get('myService') | |
}, | |
actions: { | |
testClick: function(newTemplateProperty) { | |
debugger; | |
this.get('myService').changeServiceProperty1(newTemplateProperty); | |
} | |
} | |
}); |
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({ | |
nestedService: Ember.inject.service(), | |
serviceProperty1: undefined, | |
prop2: 'property 2', | |
prop3: 'property 3', | |
init() { | |
this._super(...arguments); | |
this.set('serviceProperty1', "First service property" ); | |
}, | |
serviceMethod1: function() { | |
alert(this.get('serviceProperty1')); | |
alert(this.get('nestedService').nestedProperty); | |
}, | |
changeServiceProperty1: function(newValue) { | |
this.set('serviceProperty1', newValue); | |
}, | |
changeProp2: function(changedValue) { | |
this.set('prop2', changedValue); | |
alert('prop2 changed from another-route - Index model updated'); | |
} | |
}); |
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({ | |
nestedProperty: 'My Nested Property!' | |
}); |
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.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": "2.7.0", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "2.7.0", | |
"bootstrap-css": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css", | |
"bootstrap-js": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js", | |
"material-design-css": "https://cdn.jsdelivr.net/g/[email protected](css/bootstrap-material-design.min.css+css/ripples.min.css+css/bootstrap-material-design.css+css/ripples.css)", | |
"material-design-js": "https://cdn.jsdelivr.net/g/[email protected](js/material.min.js+js/ripples.min.js)" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment