* * ``` ]] .column_t1[.vmiddle[ ```css ``` ]] --- class: split-50 nopadding .column_t1[.vmiddle[ # JS ``` (function(){ var app = angular.module('store', ['store-products']); //---------------- * app.controller('StoreController', [ '$http', function($http) { var store = this; store.products = []; * $http.get('flatlander-02/store-products.json').success(function(data){ store.products = data; }); }]); //---------------- * app.controller('ReviewController', function() { this.review = {}; this.addReview = function(product) { this.review.createdOn = Date.now(); product.reviews.push(this.review); this.review = {}; }; }); //---------------- })(); ``` ]] .column_t2[.vmiddle[ ``` (function(){ var app = angular.module('store-products', []); //---------------- * app.directive('productGallery', function() { return { restrict: 'E', templateUrl: 'flatlander-02/templates/product-gallery.html', controller: function() { this.current = 0; this.setCurrent = function(newGallery){ this.current = newGallery || 0; }; }, controllerAs: 'gallery' }; }); //---------------- * app.directive('productTitle', function() { return { restrict: 'E', templateUrl: 'flatlander-02/templates/product-title.html' }; }); //---------------- app.directive("productSpecs", function() { return { restrict: 'A', templateUrl: 'flatlander-02/templates/product-specs.html' }; }); //---------------- * app.directive("productPanels", function() { return { restrict: 'E', templateUrl: 'flatlander-02/templates/product-panels.html', controller: function() { this.tab = 1; this.selectTab = function(setTab) { this.tab = setTab; }; this.isSelected = function(checkTab) { return this.tab === checkTab; }; }, controllerAs: 'panel' }; }); //---------------- })(); ``` ]] --- class: split-50 nopadding .column_t2[.vmiddle[ ### product-title.html ```html
``` ### product-gallery.html ```html
``` ]] .column_t1[.vmiddle[ ### product-specs.html ```html
```
]]
---
class: split-50 nopadding
.column_t1[.vmiddle[
### product-panels.html
```
Description
{{product.description}}
Reviews
...
{{review.stars}} Stars {{review.body}}
*
``` ]] --- # References 1. [AngularJS — Superheroic JavaScript MVW Framework](https://angularjs.org/) 1. [Single Page Apps with AngularJS Routing and Templating | Scotch](https://scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating) 1. [Shaping up with Angular.js](http://campus.codeschool.com/courses/shaping-up-with-angular-js/contents) 1. [Angular introduction](http://kjbekkelund.github.io/presentations/angular-intro/#1) --- class: split-30 nopadding background-image: url(https://cloud.githubusercontent.com/assets/4231611/11023047/8bebd1c6-86a0-11e5-8e5a-c08dff06cc1e.jpg) .column_t2.center[.vmiddle[ .fgtransparent[ # ] ]] .column_t2[.vmiddle.nopadding[ .shadelight[.boxtitle1[ # END ### [Eueung Mulyana](https://github.com/eueung) ### http://eueung.github.io/js/angular #### JS CodeLabs | [Attribution-ShareAlike CC BY-SA](https://creativecommons.org/licenses/by-sa/4.0/) #### ]] ]]