Last active
January 21, 2016 19:13
-
-
Save guillermohernandez/10640800c4183f481eec to your computer and use it in GitHub Desktop.
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
//product.js | |
function product(sku, name, description, price) { | |
this.sku = sku; | |
this.name = name; | |
this.description = description; | |
this.price = price; | |
} | |
//store.js shorted to 3 products | |
function store() { | |
this.products = [ | |
new product("DPGS", "Dark Purple and Green Set", "Handmade", 15), | |
new product("PBSS", "Purple & Black Speckle Set", "Handmade", 15), | |
new product("TPS", "Turquoise and Purple Set", "Handmade", 15) | |
]; | |
} | |
//app.js | |
var storeApp = angular.module('AngularStore', ['ngRoute']). | |
config(['$routeProvider', function($routeProvider) { | |
$routeProvider. | |
when('/store', { | |
templateUrl: 'views/store.html', | |
controller: storeController | |
}). | |
when('/products/:productSku', { | |
templateUrl: 'views/product.html', | |
controller: storeController | |
}). | |
when('/cart', { | |
templateUrl: 'views/shoppingCart.html', | |
controller: storeController | |
}). | |
when('/home', { | |
templateUrl: 'views/home.html', | |
controller: storeController | |
}). | |
when('/about', { | |
templateUrl: 'views/about.html', | |
controller: storeController | |
}). | |
when('/new', { | |
templateUrl: 'views/new-arrivals.html', | |
controller: storeController | |
}). | |
when('/contact', { | |
templateUrl: 'views/contact.html', | |
controller: storeController | |
}). | |
otherwise({ | |
redirectTo: '/home' | |
}); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment