Skip to content

Instantly share code, notes, and snippets.

View gajus's full-sized avatar

Gajus Kuizinas gajus

View GitHub Profile
<!DOCTYPE html>
<html ng-app="todoApp">
<head>
<title>First Test</title>
<script src="../angular.js"></script>
<script src="./todo.js"></script>
<style>
.warning { color: #f00; }
.success { color: #0f0; }
var todoApp,
model;
model = {
user: 'Adam',
items: []
};
todoApp = angular.module('todoApp', []);
<!DOCTYPE html>
<html ng-app="mainApp">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script>
angular
// Injecting customFilterApp to the mainApp, making the components (such as filters and controllers) of the customFilterApp available in the mainApp $scope.
.module('mainApp', ['customFilterApp'])
<!DOCTYPE html>
<html ng-app="mainApp">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script>
angular
// Injecting customFilterApp to the mainApp, making the components (such as filters and controllers) of the customFilterApp available in the mainApp $scope.
.module('mainApp', ['customFilterApp'])
<!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>
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>