Skip to content

Instantly share code, notes, and snippets.

View gajus's full-sized avatar

Gajus Kuizinas gajus

View GitHub Profile
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>
<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 />
<span class="error" ng-show="shippingForm.name.$error.required">
Please enter a name
<input name="street" class="form-control" ng-model="data.shipping.street" required /> <span class="error" ng-show="shippingForm.street.$error.required">
Please enter a street address
</span>
<input name="street" class="form-control" ng-model="data.shipping.street" required />
<span class="error" ng-show="shippingForm.street.$error.required">
Please enter a street address
</span>
<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 name="name" class="form-control" ng-model="data.shipping.name" required />
<span class="error" ng-show="shippingForm.name.$error.required">
Please enter a name
angular
.module('store')
.constant('productUrl', 'https://api.parse.com/1/classes/Product/')
.constant('orderUrl', 'https://api.parse.com/1/classes/Product/')
.controller('storeController', function ($scope, $http, $location, productUrl, orderUrl, cart) {
$scope.data = {};
$http
.get(productUrl, {
headers: {