Created
February 14, 2017 13:01
-
-
Save kumkanillam/f4b2a5af31a955db803b960d7ba180ba to your computer and use it in GitHub Desktop.
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.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'; | |
var server = new Pretender(function() { | |
this.get("/myModels/1", function() { | |
return [200, {}, JSON.stringify({ | |
"my-model": { | |
id: 1, | |
description: "reloaded" | |
} | |
})]; | |
}); | |
this.get("trends", function() { | |
return [200, {}, JSON.stringify({"trends":[{"viewtype":3,"name":"Trend A","daterangekey":0,"type":1,"unit":1,"actiondata":[{"label":"action 2","id":3}],"criteria":[],"id":"1000000000027"}]})]; | |
}); | |
}); | |
export default Ember.Route.extend({ | |
beforeModel() { | |
this.store.push({ | |
data: { | |
type: 'my-model', | |
id: 1, | |
attributes: { | |
description: "loaded" | |
} | |
} | |
}); | |
}, | |
model() { | |
//return this.store.findRecord('my-model', 1, { reload: true }); | |
return this.store.findAll('trend'); | |
} | |
}); |
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({ | |
description: DS.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 DS from 'ember-data'; | |
export default DS.Model.extend({ | |
name:DS.attr('string',{defaultValue:''}), | |
daterangekey:DS.attr('number',{defaultValue:0}), | |
daterange:DS.attr(), | |
actiondata:DS.attr(), | |
criteria:DS.attr({defaultValue:function(){ | |
return []; | |
}}), | |
unit:DS.attr('number',{defaultValue:1}), | |
viewtype:DS.attr('number',{defaultValue:3}) | |
}); |
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.5.3", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "1.13.13", | |
"ember-data": "1.13.15", | |
"ember-template-compiler": "1.13.13", | |
"route-recognizer": "https://rawgit.com/tildeio/route-recognizer/56f5fcec6ae58d8e86b5dc77609809fb91198142/dist/route-recognizer.js", | |
"FakeXMLHttpRequest": "https://rawgit.com/pretenderjs/FakeXMLHttpRequest/23c3a96b5b24f1bfe595867437e4f128a29c2840/fake_xml_http_request.js", | |
"pretender": "https://rawgit.com/pretenderjs/pretender/c6de9afe18b1472aded2592f5a80ad9a26a0e262/pretender.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment