Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Powerful Applications with AngularJS
Search
Anna Filina
May 30, 2015
Programming
170
0
Share
Powerful Applications with AngularJS
Anna Filina
May 30, 2015
More Decks by Anna Filina
See All by Anna Filina
Surviving a Symfony Upgrade
afilina
1
180
Upgrading Legacy to the Latest PHP Version
afilina
1
190
Better Code Design in PHP
afilina
0
300
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
200
Better Code Design in PHP
afilina
1
460
Better Code Design in PHP
afilina
0
620
Adding Tests to Untestable Legacy Code
afilina
0
400
Upgrading Legacy to the Latest PHP Version
afilina
0
430
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
330
Other Decks in Programming
See All in Programming
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
6
6.1k
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
220
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
300
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
140
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
860
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
4
510
iOS26時代の新規アプリ開発
yuukiw00w
0
180
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
140
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
250
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
160
1人1案件のプロダクトエンジニア時代に、"プロセス監督"としてチャレンジしたこと
non0113
0
160
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
5
890
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
WENDY [Excerpt]
tessaabrams
10
37k
From π to Pie charts
rasagy
0
180
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Faster Mobile Websites
deanohume
310
31k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
360
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Code Reviewing Like a Champion
maltzj
528
40k
Everyday Curiosity
cassininazir
0
210
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
Transcript
foolab.ca | @foolabca Powerful Applications with AngularJS CakeFest, New York
- May 30, 2015
Anna Filina • Developer • Problem solver • Coach •
Advisor 2
Objectives • More advanced front-end. • Maintainable code with fewer
bugs. • AngularJS site in 30 minutes. • Inspire to build great apps. 3
The problem with JS • Messy content updates. • HTML
tangled with JS. • Hard to keep everything in sync. 4
AngularJS • Automatic content updates. • HTML separated from JS
logic. • Everything automatically in sync. 5
Data flow 7 products selectedProduct
HTML <html ng-app> <head> <script src="angular.js"></script> <script src="app.js"></script> </head> <body>
<div ng-controller="ProductsCtrl"> </div> </body> </html> 8
Inside the DIV <div ng-controller="ProductsCtrl"> <div ng-repeat="item in products"> <img
ng-src="{{ item.image }}"> <p>{{ item.name }}</p> </div> </div> 9
Details <div ng-show="selectedProduct"> <h2>{{ selectedProduct.name }}</h2> </div> [...] <div ng-repeat="item
in products"> <a href="" ng-click="showDetails(item)"></a> </div> 10
Javascript function ProductsCtrl($scope) { $scope.products = [ { "id": "product-1",
"name": "Skyrim", "description": "Short product description.", "image": "http:...", "price": 19.99, "stock": 10 }]; $scope.showDetails = function(item) { $scope.selectedProduct = item; }; }; 11
Data flow 12 $scope.products $scope.showDetails $scope.selectedProduct <div ng-repeat="item in products">
<a ng-click="showDetails(item)"> <h2>{{ selectedProduct.name }}</h2>
Directives (ng-) 13 ng-show="selectedProduct" ng-class="{nostock: selectedProduct.stock == 0 }"
Data flow 15 maxPrice updateResults
HTML <input ng-model="minPrice" ng-change="updateResults()"> <div ng-repeat="item in products" ng-class="{dim: item.hidden
== true}"> 16
Javascript $scope.query = ''; $scope.minPrice = 1; $scope.maxPrice = 20;
$scope.updateResults = function() { for (var i = 0; i < $scope.products.length; i++) { var product = $scope.products[i]; product.hidden = true; [...] if (matchesQuery && matchesPrice) { product.hidden = false; } }; } 17
Directives (ng-) 18 <input ng-model="maxPrice" ng-change="updateResults()"> $scope.maxPrice $scope.updateResults = function()
{} <div ng-class="{dim: item.hidden == true}">
HTML <html ng-app="myApp"> [...] <script src="angular.js"></script> <script src="angular-resource.js"></script> 20
Javascript var app = angular.module('myApp', ['ngResource']); app.controller('ProductsCtrl', function($scope, $resource) {
var url = 'http://api.shop.dev/v1.0/products'; $resource(url).get({}, function(response) { $scope.products = response.data; }); }); 21
None
Services • Development: PHP, JS, etc. • Fix problems: bugs,
performance, etc. • Workshops: AngularJS, testing, Symfony, etc. • Advisor: testing strategy, architecture, etc. 25
@afilina afilina.com