Home | About Me
| | | | | | | | | |

AngularJS 1: Core concepts

Hands-On | 08 Apr 2015
Tags: angular, js


Core Concepts

Module / Controller Initialization

var app = angular.module(‘store’, []);
ng-app="store"> …

this way the html inside the body tag will be treated as a part of angular application
- this will be evaluated using the javascript

 

(function(){
var app = angular.module(‘store’, []);
app.controller(‘StoreController’, function(){
this.product = gem;
}); 

var gem = {
name: ‘Product name’,
price: 2.95,
description: ‘ …. ‘,
canPurchase: false,
soldOut: true
};
})();

 


ng-controller="StoreController as store">

 

Loops with ng-repeat

 ng-repeat="product in store.products">