Friday, 15 March 2013

ember.js - Is there a difference Ember getJSON if I am using Swagger JS? -



ember.js - Is there a difference Ember getJSON if I am using Swagger JS? -

to pull json model api, this:

return ember.$.getjson('http://....');

however there difference in syntax if using swagger?

i got introduced other day @ work. back-end developers starting utilize it... new of don't know how utilize on front-end?

i'm not familiar swagger @ all, can utilize promise , hook results way.

assuming swagger connection

swagger = new swaggerapi({ url: "http://petstore.swagger.wordnik.com/api/api-docs", success: function() { if(swagger.ready === true) { // upon connect, fetch pet , set contents element "mydata" } } }); model: function(){ homecoming ember.rsvp.promise(function(resolve, reject){ swagger.apis.pet.getpetbyid({petid:1}, function(data) { resolve(data.content.data); }); }); });

ember.js swagger

No comments:

Post a Comment