Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Powerful Applications with AngularJS
Search
Anna Filina
May 30, 2015
Programming
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Powerful Applications with AngularJS
Anna Filina
May 30, 2015
Transcript
21 slides
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
More Decks by Anna Filina
See All by Anna Filina
Surviving a Symfony Upgrade
afilina
1
220
Upgrading Legacy to the Latest PHP Version
afilina
1
250
Better Code Design in PHP
afilina
0
340
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
250
Better Code Design in PHP
afilina
1
500
Better Code Design in PHP
afilina
0
680
Adding Tests to Untestable Legacy Code
afilina
0
460
Upgrading Legacy to the Latest PHP Version
afilina
0
470
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
370
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
440
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
170
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
650
Kiro Crewによる開発体験ーKiro CrewでStrands Decider 2B に関する技術検証をやってみた
satoshi256kbyte
1
220
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
980
The Cost of the DOM
ypresto
3
1k
protojson における文字化けの扱い
kazuki1023
0
470
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
700
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
1k
はじめてのPLATEAU
nokonoko1203
1
680
AppFunctionsの内部実装を紐解く
hiroaki404
1
130
Debian JP Projectのサーバー構成
uwabami
1
190
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Code Reviewing Like a Champion
maltzj
529
40k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.7k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
550
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
390
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
GraphQLとの向き合い方2022年版
quramy
50
15k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
320
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360
Building an army of robots
kneath
307
47k