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
160
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
170
Upgrading Legacy to the Latest PHP Version
afilina
1
180
Better Code Design in PHP
afilina
0
300
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
190
Better Code Design in PHP
afilina
1
450
Better Code Design in PHP
afilina
0
620
Adding Tests to Untestable Legacy Code
afilina
0
390
Upgrading Legacy to the Latest PHP Version
afilina
0
420
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
320
Other Decks in Programming
See All in Programming
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
880
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
230
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
1.7k
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
130
GitHubCopilotCLIをはじめよう.pdf
htkym
0
290
Agentic Elixir
whatyouhide
0
410
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
990
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
1.1k
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
820
Programming with a DJ Controller — not vibe coding
m_seki
3
470
Kingdom of the Machine
yui_knk
2
1.1k
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
370
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
New Earth Scene 8
popppiees
3
2.1k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
340
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
How STYLIGHT went responsive
nonsquared
100
6.1k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
sira's awesome portfolio website redesign presentation
elsirapls
0
230
Why Our Code Smells
bkeepers
PRO
340
58k
Building Adaptive Systems
keathley
44
3k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
A better future with KSS
kneath
240
18k
Chasing Engaging Ingredients in Design
codingconduct
0
180
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