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
angular#3
Search
Danila Marchenkov
September 05, 2017
Education
0
46
angular#3
Danila Marchenkov
September 05, 2017
Tweet
Share
More Decks by Danila Marchenkov
See All by Danila Marchenkov
Rxjs
sprit3dan
0
100
angular6
sprit3dan
0
75
angular5
sprit3dan
0
54
angular#4
sprit3dan
0
160
angular#2
sprit3dan
0
38
Angular#1
sprit3dan
0
55
HTML 5 Canvas
sprit3dan
0
45
Angular #6
sprit3dan
0
69
Angular #5
sprit3dan
0
120
Other Decks in Education
See All in Education
子どもが自立した学習者となるデジタルの活用について
naokikato
PRO
0
180
コマンドラインを見直そう(1995年からタイムリープ)
sapi_kawahara
0
660
1021
cbtlibrary
0
400
Evaluation Methods - Lecture 6 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
0121
cbtlibrary
0
120
1216
cbtlibrary
0
140
Introduction - Lecture 1 - Advanced Topics in Big Data (4023256FNR)
signer
PRO
1
2.2k
1202
cbtlibrary
0
200
滑空スポーツ講習会2025(実技講習)EMFT講習 実施要領/JSA EMFT 2025 procedure
jsaseminar
0
100
Web Application Frameworks - Lecture 3 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
HyRead2526
cbtlibrary
0
200
JavaScript - Lecture 6 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
First, design no harm
axbom
PRO
2
1.1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
680
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
55
Building Adaptive Systems
keathley
44
2.9k
Exploring anti-patterns in Rails
aemeredith
2
250
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Believing is Seeing
oripsolob
1
53
Chasing Engaging Ingredients in Design
codingconduct
0
110
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
110
Transcript
Angular Marchenkov Danila, Software Developer
angularJS filters Pipes
Pipes Built-in Custom
import { Component } from '@angular/core'; @Component({ selector: 'hero-birthday', template:
`<p>The hero's birthday is {{ birthday | date }}</p>` }) export class HeroBirthdayComponent { birthday = new Date(1988, 3, 15); // April 15, 1988 }
aPipe | bPipe | cPipe
best way to manipulate data to display
import { Pipe, PipeTransform } from '@angular/core'; /* * Raise
the value exponentially * Takes an exponent argument that defaults to 1. * Usage: * value | exponentialStrength:exponent * Example: * {{ 2 | exponentialStrength:10 }} * formats to: 1024 */ @Pipe({name: 'exponentialStrength'}) export class ExponentialStrengthPipe implements PipeTransform { transform(value: number, exponent: string): number { let exp = parseFloat(exponent); return Math.pow(value, isNaN(exp) ? 1 : exp); } }
Pure vs Inpure
Pure pipes Angular executes a pure pipe only when it
detects a pure change to the input value. A pure change is either a change to a primitive input value (String, Number, Boolean, Symbol) or a changed object reference (Date, Array, Function, Object).
Impure pipes Angular executes an impure pipe during every component
change detection cycle
import { Pipe, PipeTransform } from '@angular/core'; import { Http
} from '@angular/http'; @Pipe({ name: 'fetch', pure: false }) export class FetchJsonPipe implements PipeTransform { private cachedData: any = null; private cachedUrl = ''; constructor(private http: Http) { } transform(url: string): any { if (url !== this.cachedUrl) { this.cachedData = null; this.cachedUrl = url; this.http.get(url) .map( result => result.json() ) .subscribe( result => this.cachedData = result ); } return this.cachedData; } }