Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Created August 13, 2014 01:15
Show Gist options
  • Save JacobHsu/a7ed705c57de116e01b4 to your computer and use it in GitHub Desktop.
Save JacobHsu/a7ed705c57de116e01b4 to your computer and use it in GitHub Desktop.
#Angular.ls : Services
(function() {
var app = angular.module('gemStore', ['store-directives']);
app.controller('StoreController', ['$http',function($http){
var store = this;
store.products = [];
$http.get('/store-products.json').success( function(data){ store.products = data;}
);
}]);
app.controller('ReviewController', function() {
this.review = {};
this.addReview = function(product) {
product.reviews.push(this.review);
this.review = {};
};
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment