Last active
December 19, 2015 00:28
-
-
Save csprocket777/5868494 to your computer and use it in GitHub Desktop.
This gist shows how to load in a json file into a single page EmberJS app as a "preferences" file and have it be persistent. I arrived on this code by trial and error during my learning of emberJS so it's probably got issues and could be more elegant. Thought it helpful to document it somewhere.
This file contains 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
Env.IndexRoute = Ember.Route.extend({ | |
model: function(){ | |
return $.ajax({ | |
url: "data/player.json", | |
dataType: "jsonp", | |
jsonpCallback:'playerData', | |
crossDomain: true | |
}); | |
}, | |
setupController: function( controller, model ) | |
{ | |
controller.set('model', model); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok. so moments after posting this I realized that my json file was more complex than I needed it to be. I restructured my json file to be simpler and was able to remove the "player[0]" portion of the previous code.