SlideShare a Scribd company logo
1 of 9
Download to read offline
Binding
natankrasney@gmail.com
1
Property Binding
‫זה‬ view‫ה‬ ‫אל‬ model ‫ה‬ ‫מתוך‬ binding ‫יצר‬ ‫אשר‬ interpolation ‫שנקרא‬ ‫מה‬ view ‫ב‬ ‫קודם‬ ‫ראינו‬
one way binding ‫נקרא‬
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<h1>{{name}}</h1>
<img src='{{url}}' /> `
})
export class AppComponent {
name = 'Angular';
url = 'http://lorempixel.com/100/100'
}
natankrasney@gmail.com
2
‫ל‬ ‫שקול‬ ‫והוא‬ property binding ‫נקרא‬ ‫הבא‬ ‫הביטוי‬
interpolation
<img [src]="url" />
view ‫אל‬ model ‫מ‬ ‫החץ‬
Property Binding - ‫סכמטי‬ ‫תאור‬
natankrasney@gmail.com
3
{ } < >
Component class Component view
class properties DOM
[ ] ‫או‬ {{ }} ‫בעזרת‬ ‫מימוש‬
Style Binding
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1 [style.color]="Enable ? 'black' : 'grey'">Hello Angular</h1>`
})
export class AppComponent {
Enable = true;
}
natankrasney@gmail.com
4
style ‫של‬ color ‫מאפין‬ ‫בין‬ Binding
model ‫ב‬ ‫מאפיין‬ ‫לבין‬ view‫ב‬
app.component.ts
view ‫אל‬ model ‫מ‬ ‫החץ‬
Class Binding
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: ` <h1>Hello Angular</h1>
<button class="my_btn" [class.extraclass]="Enable">Click Me</button>`,
styles:[ ` .my_btn{font-size:150%;}
.extraclass{color:blue;background-color:grey;}`
]
})
export class AppComponent {
Enable = true;
}
natankrasney@gmail.com
5
app.component.ts
‫מאפיין‬ ‫לבין‬ view‫ב‬ class.extraclass ‫מאפין‬ ‫בין‬ Binding
‫יופיע‬ extraclass ‫אז‬ Enable ‫אם‬ .model ‫ב‬ Enable
‫יופיע‬ ‫לא‬ ‫אחרת‬ button‫ב‬
view ‫אל‬ model ‫מ‬ ‫החץ‬
Event Binding
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<button (click)="clickHandler()">ClickMe</button>`
})
export class AppComponent {
counter:number = 0;
clickHandler(){
;this.counter++;
console.log("clicked : "+this.counter);
}
}
natankrasney@gmail.com
6
view‫ב‬ event ‫בין‬ Binding
‫החץ‬ .class ‫ב‬ method ‫לבין‬
model ‫ל‬ view ‫מ‬ - ‫הפוך‬
‫ל‬ ‫כפרמטר‬ $event ‫ב‬ ‫שימוש‬
‫פרמטרים‬ ‫לדעת‬ ‫מאפשר‬ clickHandler
‫עכבר‬ ‫בלחיצת‬ ‫לדוגמה‬ ‫חשוב‬ .‫נוספים‬
x,y ‫ב‬ ‫לשימוש‬
Event Binding - ‫סכמטי‬ ‫תאור‬
natankrasney@gmail.com
7
< >
Component class Component view
{ }
DOM eventsclass methods
( ) ‫בעזרת‬ ‫מימוש‬
Two Way Binding
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: ` <h1>Two way binding</h1>
<h2>subject : {{subject}}</h2>
<input type="text" [value]="subject" (input)="inputHandler($event)">
<button (click)="subject = ''">Clear</button>`
})
export class AppComponent {
subject = "Two way binding";
inputHandler($event : any){
this.subject = $event.target.value;
}
}natankrasney@gmail.com
8
Model : subject View: input
app.component.ts
‫משנה‬ Model ‫ב‬ subject ‫השדה‬ ‫שינוי‬
‫ולהיפך‬ View ‫ב‬ input ‫את‬
view ‫ל‬ model ‫מ‬ Binding
model ‫ל‬ view ‫מ‬ Binding
inputHandler ‫דרך‬
Two Way Binding ‫עבור‬ ngModel ‫ב‬ ‫שימוש‬
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: ` <h1>Two way binding</h1>
<h2>subject : {{subject}}</h2>
<input type="text" [(ngModel)]="subject"/>
<button (click)="subject = ''">Clear</button>`
})
export class AppComponent {
subject = "Two way binding";
}
natankrasney@gmail.com
9
‫בין‬ Two way binding
view : ‫ל‬ model - subject
input
‫מוסיפים‬ ‫עם‬ ‫רק‬ ‫עובד‬ ‫זה‬ : ‫חשוב‬
app.module.ts ‫של‬ imports ‫ל‬ FormsModule
'@angular/forms' ‫בשימוש‬
Model : subject View: input

More Related Content

What's hot

The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2Maurice De Beijer [MVP]
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation Phan Tuan
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - ServicesNir Kaufman
 
Code Camp 06 Model View Presenter Architecture
Code Camp 06   Model View Presenter ArchitectureCode Camp 06   Model View Presenter Architecture
Code Camp 06 Model View Presenter Architecturebitburner93
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Eliran Eliassy
 
Model View Presenter presentation
Model View Presenter presentationModel View Presenter presentation
Model View Presenter presentationMichael Cameron
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Ahmed Moawad
 
Angular 8
Angular 8 Angular 8
Angular 8 Sunil OS
 
Introduction To Angular's reactive forms
Introduction To Angular's reactive formsIntroduction To Angular's reactive forms
Introduction To Angular's reactive formsNir Kaufman
 
Introduction to angular js for .net developers
Introduction to angular js  for .net developersIntroduction to angular js  for .net developers
Introduction to angular js for .net developersMohd Manzoor Ahmed
 
Part 1 implementing a simple_web_service
Part 1 implementing a simple_web_servicePart 1 implementing a simple_web_service
Part 1 implementing a simple_web_servicekrishmdkk
 
AngularJS (1.x) as fast as a lightning
AngularJS (1.x)as fast as a lightningAngularJS (1.x)as fast as a lightning
AngularJS (1.x) as fast as a lightningBartłomiej Narożnik
 
Angular Mini-Challenges
Angular Mini-ChallengesAngular Mini-Challenges
Angular Mini-ChallengesJose Mendez
 
Angular js 2
Angular js 2Angular js 2
Angular js 2Ran Wahle
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency InjectionNir Kaufman
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Knoldus Inc.
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptKaty Slemon
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next FrameworkCommit University
 

What's hot (20)

The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Code Camp 06 Model View Presenter Architecture
Code Camp 06   Model View Presenter ArchitectureCode Camp 06   Model View Presenter Architecture
Code Camp 06 Model View Presenter Architecture
 
Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics Angular server side rendering - Strategies & Technics
Angular server side rendering - Strategies & Technics
 
Model View Presenter presentation
Model View Presenter presentationModel View Presenter presentation
Model View Presenter presentation
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Angular 8
Angular 8 Angular 8
Angular 8
 
Introduction To Angular's reactive forms
Introduction To Angular's reactive formsIntroduction To Angular's reactive forms
Introduction To Angular's reactive forms
 
Introduction to angular js for .net developers
Introduction to angular js  for .net developersIntroduction to angular js  for .net developers
Introduction to angular js for .net developers
 
Part 1 implementing a simple_web_service
Part 1 implementing a simple_web_servicePart 1 implementing a simple_web_service
Part 1 implementing a simple_web_service
 
AngularJS (1.x) as fast as a lightning
AngularJS (1.x)as fast as a lightningAngularJS (1.x)as fast as a lightning
AngularJS (1.x) as fast as a lightning
 
Angular Mini-Challenges
Angular Mini-ChallengesAngular Mini-Challenges
Angular Mini-Challenges
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency Injection
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
 
Angularjs Live Project
Angularjs Live ProjectAngularjs Live Project
Angularjs Live Project
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
 

Similar to Angular 2 binding

Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Ontico
 
Sharing Data Between Angular Components
Sharing Data Between Angular ComponentsSharing Data Between Angular Components
Sharing Data Between Angular ComponentsSquash Apps Pvt Ltd
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법Jeado Ko
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"GeeksLab Odessa
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2Paras Mendiratta
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesDavid Giard
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 formsEyal Vardi
 
Peggy angular 2 in meteor
Peggy   angular 2 in meteorPeggy   angular 2 in meteor
Peggy angular 2 in meteorLearningTech
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
passDataB_wComponentInAngular.pptx
passDataB_wComponentInAngular.pptxpassDataB_wComponentInAngular.pptx
passDataB_wComponentInAngular.pptxMohitUpadhyay67
 
Introduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon GauvinIntroduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon GauvinSimon Gauvin
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 
Angular Mini Hackathon Code Talks 2019
Angular Mini Hackathon Code Talks 2019Angular Mini Hackathon Code Talks 2019
Angular Mini Hackathon Code Talks 2019Maximilian Berghoff
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014Ran Wahle
 
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...Codemotion
 
Web components with Angular
Web components with AngularWeb components with Angular
Web components with AngularAna Cidre
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Katy Slemon
 
PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218bitpart
 

Similar to Angular 2 binding (20)

Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
Sharing Data Between Angular Components
Sharing Data Between Angular ComponentsSharing Data Between Angular Components
Sharing Data Between Angular Components
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법[FEConf Korea 2017]Angular 컴포넌트 대화법
[FEConf Korea 2017]Angular 컴포넌트 대화법
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
 
Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
Peggy angular 2 in meteor
Peggy   angular 2 in meteorPeggy   angular 2 in meteor
Peggy angular 2 in meteor
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
passDataB_wComponentInAngular.pptx
passDataB_wComponentInAngular.pptxpassDataB_wComponentInAngular.pptx
passDataB_wComponentInAngular.pptx
 
Introduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon GauvinIntroduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon Gauvin
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
Angular Mini Hackathon Code Talks 2019
Angular Mini Hackathon Code Talks 2019Angular Mini Hackathon Code Talks 2019
Angular Mini Hackathon Code Talks 2019
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...
The Web Components interoperability challenge - Horacio Gonzalez - Codemotion...
 
Web components with Angular
Web components with AngularWeb components with Angular
Web components with Angular
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218
 

More from Nathan Krasney

More from Nathan Krasney (19)

Introduction to Semantic ui-react
Introduction to Semantic ui-reactIntroduction to Semantic ui-react
Introduction to Semantic ui-react
 
React introduction
React introductionReact introduction
React introduction
 
Angular 2 jump start
Angular 2 jump startAngular 2 jump start
Angular 2 jump start
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
Angular 2 - Typescript
Angular 2  - TypescriptAngular 2  - Typescript
Angular 2 - Typescript
 
ADO.Net
ADO.NetADO.Net
ADO.Net
 
JQuery
JQueryJQuery
JQuery
 
ASP.net Security
ASP.net SecurityASP.net Security
ASP.net Security
 
ASP.net Web Pages
ASP.net Web PagesASP.net Web Pages
ASP.net Web Pages
 
ASP.net MVC
ASP.net MVCASP.net MVC
ASP.net MVC
 
CSS
CSSCSS
CSS
 
Javascript with json
Javascript with jsonJavascript with json
Javascript with json
 
javascript
javascriptjavascript
javascript
 
Javascript ajax
Javascript ajaxJavascript ajax
Javascript ajax
 
HTML5
HTML5 HTML5
HTML5
 
HTML
HTML HTML
HTML
 
קורס אנדרואיד
קורס אנדרואידקורס אנדרואיד
קורס אנדרואיד
 
Lessons learned from 6 month project with india based software house
Lessons learned from 6 month project with india based software houseLessons learned from 6 month project with india based software house
Lessons learned from 6 month project with india based software house
 
Introduction to big data
Introduction to big data Introduction to big data
Introduction to big data
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 

Angular 2 binding

  • 2. Property Binding ‫זה‬ view‫ה‬ ‫אל‬ model ‫ה‬ ‫מתוך‬ binding ‫יצר‬ ‫אשר‬ interpolation ‫שנקרא‬ ‫מה‬ view ‫ב‬ ‫קודם‬ ‫ראינו‬ one way binding ‫נקרא‬ import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>{{name}}</h1> <img src='{{url}}' /> ` }) export class AppComponent { name = 'Angular'; url = 'http://lorempixel.com/100/100' } natankrasney@gmail.com 2 ‫ל‬ ‫שקול‬ ‫והוא‬ property binding ‫נקרא‬ ‫הבא‬ ‫הביטוי‬ interpolation <img [src]="url" /> view ‫אל‬ model ‫מ‬ ‫החץ‬
  • 3. Property Binding - ‫סכמטי‬ ‫תאור‬ natankrasney@gmail.com 3 { } < > Component class Component view class properties DOM [ ] ‫או‬ {{ }} ‫בעזרת‬ ‫מימוש‬
  • 4. Style Binding import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<h1 [style.color]="Enable ? 'black' : 'grey'">Hello Angular</h1>` }) export class AppComponent { Enable = true; } natankrasney@gmail.com 4 style ‫של‬ color ‫מאפין‬ ‫בין‬ Binding model ‫ב‬ ‫מאפיין‬ ‫לבין‬ view‫ב‬ app.component.ts view ‫אל‬ model ‫מ‬ ‫החץ‬
  • 5. Class Binding import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>Hello Angular</h1> <button class="my_btn" [class.extraclass]="Enable">Click Me</button>`, styles:[ ` .my_btn{font-size:150%;} .extraclass{color:blue;background-color:grey;}` ] }) export class AppComponent { Enable = true; } natankrasney@gmail.com 5 app.component.ts ‫מאפיין‬ ‫לבין‬ view‫ב‬ class.extraclass ‫מאפין‬ ‫בין‬ Binding ‫יופיע‬ extraclass ‫אז‬ Enable ‫אם‬ .model ‫ב‬ Enable ‫יופיע‬ ‫לא‬ ‫אחרת‬ button‫ב‬ view ‫אל‬ model ‫מ‬ ‫החץ‬
  • 6. Event Binding import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: `<button (click)="clickHandler()">ClickMe</button>` }) export class AppComponent { counter:number = 0; clickHandler(){ ;this.counter++; console.log("clicked : "+this.counter); } } natankrasney@gmail.com 6 view‫ב‬ event ‫בין‬ Binding ‫החץ‬ .class ‫ב‬ method ‫לבין‬ model ‫ל‬ view ‫מ‬ - ‫הפוך‬ ‫ל‬ ‫כפרמטר‬ $event ‫ב‬ ‫שימוש‬ ‫פרמטרים‬ ‫לדעת‬ ‫מאפשר‬ clickHandler ‫עכבר‬ ‫בלחיצת‬ ‫לדוגמה‬ ‫חשוב‬ .‫נוספים‬ x,y ‫ב‬ ‫לשימוש‬
  • 7. Event Binding - ‫סכמטי‬ ‫תאור‬ natankrasney@gmail.com 7 < > Component class Component view { } DOM eventsclass methods ( ) ‫בעזרת‬ ‫מימוש‬
  • 8. Two Way Binding import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>Two way binding</h1> <h2>subject : {{subject}}</h2> <input type="text" [value]="subject" (input)="inputHandler($event)"> <button (click)="subject = ''">Clear</button>` }) export class AppComponent { subject = "Two way binding"; inputHandler($event : any){ this.subject = $event.target.value; } }natankrasney@gmail.com 8 Model : subject View: input app.component.ts ‫משנה‬ Model ‫ב‬ subject ‫השדה‬ ‫שינוי‬ ‫ולהיפך‬ View ‫ב‬ input ‫את‬ view ‫ל‬ model ‫מ‬ Binding model ‫ל‬ view ‫מ‬ Binding inputHandler ‫דרך‬
  • 9. Two Way Binding ‫עבור‬ ngModel ‫ב‬ ‫שימוש‬ import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>Two way binding</h1> <h2>subject : {{subject}}</h2> <input type="text" [(ngModel)]="subject"/> <button (click)="subject = ''">Clear</button>` }) export class AppComponent { subject = "Two way binding"; } natankrasney@gmail.com 9 ‫בין‬ Two way binding view : ‫ל‬ model - subject input ‫מוסיפים‬ ‫עם‬ ‫רק‬ ‫עובד‬ ‫זה‬ : ‫חשוב‬ app.module.ts ‫של‬ imports ‫ל‬ FormsModule '@angular/forms' ‫בשימוש‬ Model : subject View: input