Skip to content

Instantly share code, notes, and snippets.

View gajus's full-sized avatar

Gajus Kuizinas gajus

View GitHub Profile
angular
.module('store')
.constant('productListActiveClass', 'active')
.controller('productListController', function ($scope, $filter, productListActiveClass) {
var selectedCategory = null;
$scope.selectCategory = function (categoryName) {
selectedCategory = categoryName;
};
angular
.module('store')
.constant('productListActiveClass', 'active')
.controller('productListController', function ($scope, $filter, productListActiveClass) {
var selectedCategory = null;
$scope.selectCategory = function (categoryName) {
selectedCategory = categoryName;
};
angular
.module('customFilters', [])
.filter('unique', function () {
return function (data, propertyName) {
if (angular.isArray(data) && angular.isString(propertyName)) {
var results = [];
var keys = {};
for (var i = 0; i < data.length; i++) {
var val = data[i][propertyName];
if (angular.isUndefined(keys[val])) {
<!DOCTYPE html>
<html ng-app="store">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script src="./static/js/store.js"></script>
<script src="./static/js/controllers/store.js"></script>
<script src="./static/js/controllers/productListControllers.js"></script>
<script src="./static/js/filters/customFilters.js"></script>
<!DOCTYPE html>
<html ng-app="store">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script src="./static/js/store.js"></script>
<script src="./static/js/controllers/store.js"></script>
<script src="./static/js/controllers/productListControllers.js"></script>
<script src="./static/js/filters/customFilters.js"></script>
angular
.module('cart', []);
.factory('cart', function () {
var cartData = {};
return {
addProduct: function (id, name, price) {
var addToExistingItem = false;
for (var i = 0; i < cartData.length; i++) {
angular
.module('cart', []);
.factory('cart', function () {
var cartData = {};
return {
addProduct: function (id, name, price) {
var addToExistingItem = false;
for (var i = 0; i < cartData.length; i++) {
<!DOCTYPE html>
<html ng-app="store">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script src="./static/js/store.js"></script>
<script src="./static/js/controllers/store.js"></script>
<script src="./static/js/controllers/productListControllers.js"></script>
<script src="./static/js/filters/customFilters.js"></script>
html,
body,
ul,
li {
margin: 0; padding: 0;
}
body {
font: normal 16px/24px "Helvetica Neue", Helvetica, Arial, freesans, sans-serif; background: #c1c1c1;
}
<div id="place-order" class="row">
<h2>Check out now</h2>
<p>Please enter your details, and we'll ship your goods right away!</p>
<form name="shippingForm" novalidate>
<h3>Ship to</h3>
<div class="form-group">
<label>Name</label>
<input class="form-control" ng-model="data.shipping.name" required />
</div>
<h3>Address</h3>