Learning Notes Angular

1
2
3
4
5
6
7
8
9
<body class="container" ng-controller="StoreController as store">
<div class="product row">
<h3>
<em class="pull-right">$</em>
</h3>
<button>Add to Cart</button>
</div>
</body>
1
<button ng-show="store.product.canPurchase">Add to Cart</button>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(function() {
var app = angular.module('gemStore', []);
app.controller('StoreController', function(){
this.product = gem;
});
var gem = {
name: 'Azurite',
price: 110.50,
canPurchase: false,
soldOut: true
};
})();
  • ng-hide
1
2
3
4
5
6
7
8
<body class="container" ng-controller="StoreController as store">
<div class="product row" ng-repeat="product in store.products">
<h3>
<em class="pull-right">$</em>
</h3>
</div>
</body>
1
<em class="pull-right">{{product.price | currency </em>
  • Pipe - “send the output into”