Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Analytics Experiments in AngularJS - productcontroller.js
'use strict';
angular.module('myStoreApp')
.controller('ProductController', ['$scope', '$routeParams','$http', '$window', function($scope, $routeParams, $http, $window){
$scope.variant = $window.variant;
$http.get('api.mystore.com/products/'+$routeParams.id)
.success(function(product){
$scope.product = product;
});
$scope.addToCart = function(){
//Add product to user's shopping cart
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.