AngularTestbed/javascript/main.js
2014-05-15 21:19:12 -04:00

30 lines
643 B
JavaScript

/**
* Created by tsouza on 5/15/14.
*/
(function(){
var app = angular.module("playground", []);
app.controller("PlaygroundController", function($scope, playgroundService){
var self = this;
this.playgrounds = {};
playgroundService.getPlaygrounds()
.then(function(playgrounds){
self.playgrounds = playgrounds;
});
});
var playgroundService = app.factory("playgroundService", function($http) {
return {
getPlaygrounds: function () {
return $http.get("data/playgrounds.json")
.then(function (result) {
return result.data;
});
}
}
});
})();