-
-
Save Gaurav0/63bfea3c63fc3d01924b5d77d59c3c49 to your computer and use it in GitHub Desktop.
Weird Behavior
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 DS from 'ember-data'; | |
| export default DS.RESTAdapter; |
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({ | |
| actions: { | |
| saveCount(event) { | |
| let model = this.get('model'); | |
| let value = parseInt(event.target.value); | |
| model.set('count', value); | |
| model.save(); | |
| } | |
| } | |
| }); |
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'; | |
| new Pretender(function() { | |
| this.get('/counters/123', function() { | |
| return [200, {}, JSON.stringify({ | |
| counter: { id: '123', count: 0 } | |
| })]; | |
| }, 1000); | |
| this.put('/counters/123', function(request) { | |
| let count = JSON.parse(request.requestBody).counter.count; | |
| return [200, {}, JSON.stringify({ | |
| counter: { id: '123', count: count } | |
| })]; | |
| }, 1000); | |
| }); | |
| export default Ember.Route.extend({ | |
| model() { | |
| return this.store.find('counter', '123'); | |
| } | |
| }); |
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 DS from 'ember-data'; | |
| export default DS.Model.extend({ | |
| count: DS.attr('number') | |
| }); |
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.6.0", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.3.1/ember.debug.js", | |
| "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.3.3/ember-data.js", | |
| "ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.3.1/ember-template-compiler.js", | |
| "route-recognizer": "https://npmcdn.com/route-recognizer@0.1.9/dist/route-recognizer.js", | |
| "fake-xml-http-request": "https://npmcdn.com/fake-xml-http-request@1.3.0/fake_xml_http_request.js", | |
| "pretender": "https://npmcdn.com/pretender@0.12.0/pretender.js" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment