(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
Software IndustrySultan Ahmed Sagor
Angular 7
A framework for Presentation Layer
Software IndustrySultan Ahmed Sagor
Software IndustrySultan Ahmed Sagor
7
Software IndustrySultan Ahmed Sagor
Angular Tutorial: Road Covered So Far
Software IndustrySultan Ahmed Sagor
What are Components ?
Now we will discuss components in details
Software IndustrySultan Ahmed Sagor
What are Components ?
A component controls a patch of screen real estate that we can call a view and
declares reusable UI building blocks for an application.
Software IndustrySultan Ahmed Sagor
Components Example
Software IndustrySultan Ahmed Sagor
Components Example
Sidebar
Component
Software IndustrySultan Ahmed Sagor
Components Example
Sidebar
Component
< >
Courses Component
< >
Software IndustrySultan Ahmed Sagor
Components Example
Sidebar
Component
Courses Component
Search Bar < > Nav-Bar < >
Software IndustrySultan Ahmed Sagor
Components Example
Sidebar
Component
Courses Component
Search Bar < > Nav-Bar < >
Header Component < >
Software IndustrySultan Ahmed Sagor
Components Example
Sidebar
Component
Software IndustrySultan Ahmed Sagor
Components Parent/Child Tree Structure
Sidebar
Component
App Component
Sidebar Component Header Component Courses Component
Search Bar Component Nav-bar Component
Software IndustrySultan Ahmed Sagor
What are Components ?
A component controls a patch of screen real estate
that we can call a view and declares reusable UI
building blocks for an application.
Software IndustrySultan Ahmed Sagor
Creating a Component ?
Now we will discuss how to create
components
Software IndustrySultan Ahmed Sagor
Creating a Component
Software IndustrySultan Ahmed Sagor
Creating a Component
A Simple
Type-Script Class
Meta-Data
For Class
Software IndustrySultan Ahmed Sagor
AppComponent: The Root Component ?
Angular is not just a framework.
Software IndustrySultan Ahmed Sagor
Key Points To Remember
Software IndustrySultan Ahmed Sagor
Angular App Bootstrapping
Let us know some basic staffs
Software IndustrySultan Ahmed Sagor
Angular App Bootstrapping
main.ts AppModule AppComponent
❖ Main typescript file from where
the execution begins
❖ Initializes the platform browser
where the app will run and
bootstrap AppModule
❖ Root Module of Angular App
❖ Bootstrap AppComponent and
inserts it into the index.html
host web page
❖ Root Component under which
other components are nested
❖ First Component to inserted in
the DOM.
Software IndustrySultan Ahmed Sagor
main.ts
Software IndustrySultan Ahmed Sagor
AppModule
Software IndustrySultan Ahmed Sagor
AppModule
Software IndustrySultan Ahmed Sagor
AppComponent
Software IndustrySultan Ahmed Sagor
Why Angular Apps Are Bootstrapped
Lets discuss
Software IndustrySultan Ahmed Sagor
Why Angular App is bootstrapped
❖ Allow us to write Angular App that can be hosted on other environments
❖ Import the platform based Applications
❖ For example,
❖ @angular/platform-browser-dynamic is used for running the app on
browser.
Angular is not only a framework for creating WEB-only Applications
Software IndustrySultan Ahmed Sagor
Application Specification
Let us do some practical
Software IndustrySultan Ahmed Sagor
Tour Of Heroes
❖ By the end of this tutorial, we will create the following web page using Angular components.
Software IndustrySultan Ahmed Sagor
Tour Of Heroes
❖ You can click the two links above the dashboard
("Dashboard" and "Heroes") to navigate between this
Dashboard view and a Heroes view.
❖ If you click the dashboard hero "Magneta," the router o
pens a "Hero Details“ view where you can change the hero's name.
Software IndustrySultan Ahmed Sagor
Tour Of Heroes
Clicking the "Back" button returns you to the Dashboard. Links at the top
take you to either of the main views. If you click "Heroes," the app
displays the "Heroes" master list view.
Software IndustrySultan Ahmed Sagor
Tour Of Heroes
❖ When you click a different hero name, the read-
only mini detail beneath the list reflects the new
choice.
❖ You can click the "View Details" button to drill into
the editable details of the selected hero.
Software IndustrySultan Ahmed Sagor
Tour Of Heroes Demo
Let us do develop the application
Software IndustrySultan Ahmed Sagor
Tour Of Heroes
❖ Let us create a Hero component.
❖ Command of creating hero component:
❖ ng generate component heroes
❖ As a result, the following classes/html file will be created:
❖ heroes.component.ts
❖
Software IndustrySultan Ahmed Sagor
heroes.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.css']
})
export class HeroesComponent implements OnInit {
hero: Hero = { id: 1, name: 'Windstorm' };
constructor() { }
ngOnInit() { }
}
Software IndustrySultan Ahmed Sagor
Create a Hero class
❖ Let us create a Hero class to hold all the information that hero can contain
❖ Path: src/app/hero.ts
export class Hero {
id: number;
name: string;
}
Software IndustrySultan Ahmed Sagor
Show the Hero Object
❖ Let us create a Hero class to hold all the information that hero can contain
<h2>{{hero.name}} Details</h2>
<div><span>id: </span>{{hero.id}}</div>
<div><span>name: </span>{{hero.name}}</div>
Software IndustrySultan Ahmed Sagor
Format with UpperCasePipe
❖ Let us create a Hero class to hold all the information that hero can contain
<h2>{{hero.name | uppercase}} Details</h2>
Software IndustrySultan Ahmed Sagor
Edit The hero
❖ Users should be able to edit the hero name in an <input> textbox.
❖ The textbox should both display the hero's name property and update that property as the user types.
❖ That means data flows from the component class out to the screen and from the screen back to the class.
❖ To automate that data flow, setup a two-way data binding between the <input> form element and the
hero.name property.
Software IndustrySultan Ahmed Sagor
Two-Way Binding
<div>
<label>name:
<input [(ngModel)]="hero.name" placeholder="name"/>
</label>
</div>
Software IndustrySultan Ahmed Sagor
The missing FormsModule
❖ Notice that the app stopped working when you added [(ngModel)].
❖ To see the error, open the browser development tools and look in the console for a message like
Software IndustrySultan Ahmed Sagor
AppModule
❖ Angular needs to know how the pieces of your application fit together and what other files and libraries the
app requires. This information is called metadata.
❖ Some of the metadata is in the @Component decorators that you added to your component classes. Other
critical metadata is in @NgModule decorators.
❖ The most important @NgModule decorator annotates the top-level AppModule class.
❖ The Angular CLI generated an AppModule class in src/app/app.module.ts when it created the project. This is
where you opt-in to the FormsModule.
Software IndustrySultan Ahmed Sagor
Import FormsModule
❖ Open AppModule (app.module.ts) and import the FormsModule symbol from the @angular/forms library.
import { FormsModule } from '@angular/forms'; // <-- NgModel lives here
❖ Thenn add FormsModule to the @NgModule metadata's imports array, which contains a list of external modules that the app
needs.
imports: [
BrowserModule,
FormsModule
],
Software IndustrySultan Ahmed Sagor
Declare the HeroesComponent
❖ Every component must be declared in exactly one NgModule.
❖ You didn't declare the HeroesComponent. So why did the application work?
❖ It worked because the Angular CLI declared HeroesComponent in the AppModule when it generated that component
❖ Open src/app/app.module.ts and find HeroesComponent imported near the top.
Software IndustrySultan Ahmed Sagor
Declare the HeroesComponent
import { HeroesComponent } from './heroes/heroes.component';
❖ The HeroesComponent is declared in the @NgModule.declarations array.
declarations: [
AppComponent,
HeroesComponent
],
Software IndustrySultan Ahmed Sagor
Any
question?
Software IndustrySultan Ahmed Sagor
Thank You

More Related Content

What's hot

Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
Angular overview
Angular overviewAngular overview
Angular overview
Thanvilahari
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
Web api
Web apiWeb api
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
NexThoughts Technologies
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2
Knoldus Inc.
 
React js
React jsReact js
React js
Rajesh Kolla
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
DivyanshGupta922023
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
Sergey Romaneko
 
Intro to React
Intro to ReactIntro to React
Intro to React
Eric Westfall
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
Sunil Yadav
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
Akshay Mathur
 
Angular routing
Angular routingAngular routing
Angular routing
Sultan Ahmed
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
Jennifer Estrada
 
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Edureka!
 
Angular 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
Rob Quick
 
React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
AnmolPandita7
 
React state
React  stateReact  state
React state
Ducat
 

What's hot (20)

Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Angular overview
Angular overviewAngular overview
Angular overview
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Web api
Web apiWeb api
Web api
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2Routing & Navigating Pages in Angular 2
Routing & Navigating Pages in Angular 2
 
React js
React jsReact js
React js
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Angular routing
Angular routingAngular routing
Angular routing
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
Angular Directives | Angular 2 Custom Directives | Angular Tutorial | Angular...
 
Angular 8
Angular 8 Angular 8
Angular 8
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
 
React state
React  stateReact  state
React state
 

Similar to Angular components

Angular data binding
Angular data binding Angular data binding
Angular data binding
Sultan Ahmed
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Angular IO
Angular IOAngular IO
Angular IO
Jennifer Estrada
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdf
JohnLeo57
 
mean stack
mean stackmean stack
mean stack
michaelaaron25322
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
04 objective-c session 4
04  objective-c session 404  objective-c session 4
04 objective-c session 4
Amr Elghadban (AmrAngry)
 
Bootiful Development with Spring Boot and Angular - RWX 2018
Bootiful Development with Spring Boot and Angular - RWX 2018Bootiful Development with Spring Boot and Angular - RWX 2018
Bootiful Development with Spring Boot and Angular - RWX 2018
Matt Raible
 
Angular 2 in-1
Angular 2 in-1 Angular 2 in-1
Angular 2 in-1
GlobalLogic Ukraine
 
ASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a couple
Alexandre Marreiros
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
TejinderMakkar
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Digamber Singh
 
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
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
RapidValue
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
Ahmed Moawad
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
Pratik Patel
 
Start your journey with angular | Basic Angular
Start your journey with angular | Basic AngularStart your journey with angular | Basic Angular
Start your journey with angular | Basic Angular
Anwarul Islam
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Katy Slemon
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 

Similar to Angular components (20)

Angular data binding
Angular data binding Angular data binding
Angular data binding
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Angular IO
Angular IOAngular IO
Angular IO
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdf
 
mean stack
mean stackmean stack
mean stack
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
 
04 objective-c session 4
04  objective-c session 404  objective-c session 4
04 objective-c session 4
 
Bootiful Development with Spring Boot and Angular - RWX 2018
Bootiful Development with Spring Boot and Angular - RWX 2018Bootiful Development with Spring Boot and Angular - RWX 2018
Bootiful Development with Spring Boot and Angular - RWX 2018
 
Angular 2 in-1
Angular 2 in-1 Angular 2 in-1
Angular 2 in-1
 
ASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a coupleASP.NEt MVC and Angular What a couple
ASP.NEt MVC and Angular What a couple
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 
Angular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive FormsAngular 7 Firebase5 CRUD Operations with Reactive Forms
Angular 7 Firebase5 CRUD Operations with Reactive Forms
 
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...
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Start your journey with angular | Basic Angular
Start your journey with angular | Basic AngularStart your journey with angular | Basic Angular
Start your journey with angular | Basic Angular
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 

Recently uploaded

Pancreatic-Cancer-Sophie-Heriot versatile.pdf
Pancreatic-Cancer-Sophie-Heriot versatile.pdfPancreatic-Cancer-Sophie-Heriot versatile.pdf
Pancreatic-Cancer-Sophie-Heriot versatile.pdf
ShaliniN51
 
AI in DIGITAL Marketing course training.pdf
AI in DIGITAL Marketing course training.pdfAI in DIGITAL Marketing course training.pdf
AI in DIGITAL Marketing course training.pdf
kruthikchinnagari
 
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
barnarddl76248
 
一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理
u8qzove
 
blue professional modern CV resume_20240324_122005_0000.pdf
blue professional modern CV resume_20240324_122005_0000.pdfblue professional modern CV resume_20240324_122005_0000.pdf
blue professional modern CV resume_20240324_122005_0000.pdf
aishwarymane6025
 
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
brielleralker1558
 
Manasi Dinkar Sawant resume for careerpdf
Manasi Dinkar Sawant resume for careerpdfManasi Dinkar Sawant resume for careerpdf
Manasi Dinkar Sawant resume for careerpdf
manasisawant1509
 
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
k7nm6tk
 
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
andagarcia212
 
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptxHarmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
jordaanharmond
 
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
karimimorine448
 
一比一原版马来西亚博特拉大学毕业证如何办理
一比一原版马来西亚博特拉大学毕业证如何办理一比一原版马来西亚博特拉大学毕业证如何办理
一比一原版马来西亚博特拉大学毕业证如何办理
byyi0h
 
SEO Audit Checklist for SEO Professional
SEO Audit Checklist for SEO ProfessionalSEO Audit Checklist for SEO Professional
SEO Audit Checklist for SEO Professional
Mohamed Askaf
 
Aishwarya Uday Mane Rersume career .pdf
Aishwarya Uday Mane Rersume  career .pdfAishwarya Uday Mane Rersume  career .pdf
Aishwarya Uday Mane Rersume career .pdf
sanikaphadatare48
 
Mitali Sawant BCA student of MKSSS resume.pdf
Mitali Sawant BCA student of MKSSS resume.pdfMitali Sawant BCA student of MKSSS resume.pdf
Mitali Sawant BCA student of MKSSS resume.pdf
sawantmitali1430
 
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
auagoh
 
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
kumaramin565
 
Sanika Rajendra Phadatare resume for career 2.pdf
Sanika Rajendra Phadatare resume for career 2.pdfSanika Rajendra Phadatare resume for career 2.pdf
Sanika Rajendra Phadatare resume for career 2.pdf
sanikaphadatare48
 
How To Manage Multiple Product Teams For Successful Development & Delivery
How To Manage Multiple Product Teams For Successful Development & DeliveryHow To Manage Multiple Product Teams For Successful Development & Delivery
How To Manage Multiple Product Teams For Successful Development & Delivery
Aggregage
 
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
Robert Pinter
 

Recently uploaded (20)

Pancreatic-Cancer-Sophie-Heriot versatile.pdf
Pancreatic-Cancer-Sophie-Heriot versatile.pdfPancreatic-Cancer-Sophie-Heriot versatile.pdf
Pancreatic-Cancer-Sophie-Heriot versatile.pdf
 
AI in DIGITAL Marketing course training.pdf
AI in DIGITAL Marketing course training.pdfAI in DIGITAL Marketing course training.pdf
AI in DIGITAL Marketing course training.pdf
 
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
体育博彩平台排名-体育博彩平台排名足彩-体育博彩平台排名足彩竞猜|【​网址​🎉ac44.net🎉​】
 
一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理
 
blue professional modern CV resume_20240324_122005_0000.pdf
blue professional modern CV resume_20240324_122005_0000.pdfblue professional modern CV resume_20240324_122005_0000.pdf
blue professional modern CV resume_20240324_122005_0000.pdf
 
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
2024欧洲杯盘口-2024欧洲杯盘口投注竞彩-2024欧洲杯盘口竞猜投注 |【​网址​🎉ac99.net🎉​】
 
Manasi Dinkar Sawant resume for careerpdf
Manasi Dinkar Sawant resume for careerpdfManasi Dinkar Sawant resume for careerpdf
Manasi Dinkar Sawant resume for careerpdf
 
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
一比一原版(UCF毕业证书)美国中佛罗里达大学毕业证如何办理
 
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
全球十大欧洲杯博彩app排行-全球十大欧洲杯博彩app排行 |【​网址​🎉ac22.net🎉​】
 
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptxHarmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
Harmond_Jordaan_DMBS_PB1_2024-06 (1).pptx
 
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
2024欧洲杯赔率-2024欧洲杯赔率下注网址-2024欧洲杯赔率下注网站 |【​网址​🎉ac10.net🎉​】
 
一比一原版马来西亚博特拉大学毕业证如何办理
一比一原版马来西亚博特拉大学毕业证如何办理一比一原版马来西亚博特拉大学毕业证如何办理
一比一原版马来西亚博特拉大学毕业证如何办理
 
SEO Audit Checklist for SEO Professional
SEO Audit Checklist for SEO ProfessionalSEO Audit Checklist for SEO Professional
SEO Audit Checklist for SEO Professional
 
Aishwarya Uday Mane Rersume career .pdf
Aishwarya Uday Mane Rersume  career .pdfAishwarya Uday Mane Rersume  career .pdf
Aishwarya Uday Mane Rersume career .pdf
 
Mitali Sawant BCA student of MKSSS resume.pdf
Mitali Sawant BCA student of MKSSS resume.pdfMitali Sawant BCA student of MKSSS resume.pdf
Mitali Sawant BCA student of MKSSS resume.pdf
 
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
一比一原版(isu学位证书)爱荷华州立大学毕业证如何办理
 
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
澳门十大欧洲杯盘口赔率大全-澳门欧洲杯盘口赔率网站大全 |【​网址​🎉ac44.net🎉​】
 
Sanika Rajendra Phadatare resume for career 2.pdf
Sanika Rajendra Phadatare resume for career 2.pdfSanika Rajendra Phadatare resume for career 2.pdf
Sanika Rajendra Phadatare resume for career 2.pdf
 
How To Manage Multiple Product Teams For Successful Development & Delivery
How To Manage Multiple Product Teams For Successful Development & DeliveryHow To Manage Multiple Product Teams For Successful Development & Delivery
How To Manage Multiple Product Teams For Successful Development & Delivery
 
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
Adapting to Change: Thriving in the Digital Age through the Right Skills and ...
 

Angular components

  • 1. Software IndustrySultan Ahmed Sagor Angular 7 A framework for Presentation Layer
  • 4. Software IndustrySultan Ahmed Sagor Angular Tutorial: Road Covered So Far
  • 5. Software IndustrySultan Ahmed Sagor What are Components ? Now we will discuss components in details
  • 6. Software IndustrySultan Ahmed Sagor What are Components ? A component controls a patch of screen real estate that we can call a view and declares reusable UI building blocks for an application.
  • 7. Software IndustrySultan Ahmed Sagor Components Example
  • 8. Software IndustrySultan Ahmed Sagor Components Example Sidebar Component
  • 9. Software IndustrySultan Ahmed Sagor Components Example Sidebar Component < > Courses Component < >
  • 10. Software IndustrySultan Ahmed Sagor Components Example Sidebar Component Courses Component Search Bar < > Nav-Bar < >
  • 11. Software IndustrySultan Ahmed Sagor Components Example Sidebar Component Courses Component Search Bar < > Nav-Bar < > Header Component < >
  • 12. Software IndustrySultan Ahmed Sagor Components Example Sidebar Component
  • 13. Software IndustrySultan Ahmed Sagor Components Parent/Child Tree Structure Sidebar Component App Component Sidebar Component Header Component Courses Component Search Bar Component Nav-bar Component
  • 14. Software IndustrySultan Ahmed Sagor What are Components ? A component controls a patch of screen real estate that we can call a view and declares reusable UI building blocks for an application.
  • 15. Software IndustrySultan Ahmed Sagor Creating a Component ? Now we will discuss how to create components
  • 16. Software IndustrySultan Ahmed Sagor Creating a Component
  • 17. Software IndustrySultan Ahmed Sagor Creating a Component A Simple Type-Script Class Meta-Data For Class
  • 18. Software IndustrySultan Ahmed Sagor AppComponent: The Root Component ? Angular is not just a framework.
  • 19. Software IndustrySultan Ahmed Sagor Key Points To Remember
  • 20. Software IndustrySultan Ahmed Sagor Angular App Bootstrapping Let us know some basic staffs
  • 21. Software IndustrySultan Ahmed Sagor Angular App Bootstrapping main.ts AppModule AppComponent ❖ Main typescript file from where the execution begins ❖ Initializes the platform browser where the app will run and bootstrap AppModule ❖ Root Module of Angular App ❖ Bootstrap AppComponent and inserts it into the index.html host web page ❖ Root Component under which other components are nested ❖ First Component to inserted in the DOM.
  • 23. Software IndustrySultan Ahmed Sagor AppModule
  • 24. Software IndustrySultan Ahmed Sagor AppModule
  • 25. Software IndustrySultan Ahmed Sagor AppComponent
  • 26. Software IndustrySultan Ahmed Sagor Why Angular Apps Are Bootstrapped Lets discuss
  • 27. Software IndustrySultan Ahmed Sagor Why Angular App is bootstrapped ❖ Allow us to write Angular App that can be hosted on other environments ❖ Import the platform based Applications ❖ For example, ❖ @angular/platform-browser-dynamic is used for running the app on browser. Angular is not only a framework for creating WEB-only Applications
  • 28. Software IndustrySultan Ahmed Sagor Application Specification Let us do some practical
  • 29. Software IndustrySultan Ahmed Sagor Tour Of Heroes ❖ By the end of this tutorial, we will create the following web page using Angular components.
  • 30. Software IndustrySultan Ahmed Sagor Tour Of Heroes ❖ You can click the two links above the dashboard ("Dashboard" and "Heroes") to navigate between this Dashboard view and a Heroes view. ❖ If you click the dashboard hero "Magneta," the router o pens a "Hero Details“ view where you can change the hero's name.
  • 31. Software IndustrySultan Ahmed Sagor Tour Of Heroes Clicking the "Back" button returns you to the Dashboard. Links at the top take you to either of the main views. If you click "Heroes," the app displays the "Heroes" master list view.
  • 32. Software IndustrySultan Ahmed Sagor Tour Of Heroes ❖ When you click a different hero name, the read- only mini detail beneath the list reflects the new choice. ❖ You can click the "View Details" button to drill into the editable details of the selected hero.
  • 33. Software IndustrySultan Ahmed Sagor Tour Of Heroes Demo Let us do develop the application
  • 34. Software IndustrySultan Ahmed Sagor Tour Of Heroes ❖ Let us create a Hero component. ❖ Command of creating hero component: ❖ ng generate component heroes ❖ As a result, the following classes/html file will be created: ❖ heroes.component.ts ❖
  • 35. Software IndustrySultan Ahmed Sagor heroes.component.ts import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-heroes', templateUrl: './heroes.component.html', styleUrls: ['./heroes.component.css'] }) export class HeroesComponent implements OnInit { hero: Hero = { id: 1, name: 'Windstorm' }; constructor() { } ngOnInit() { } }
  • 36. Software IndustrySultan Ahmed Sagor Create a Hero class ❖ Let us create a Hero class to hold all the information that hero can contain ❖ Path: src/app/hero.ts export class Hero { id: number; name: string; }
  • 37. Software IndustrySultan Ahmed Sagor Show the Hero Object ❖ Let us create a Hero class to hold all the information that hero can contain <h2>{{hero.name}} Details</h2> <div><span>id: </span>{{hero.id}}</div> <div><span>name: </span>{{hero.name}}</div>
  • 38. Software IndustrySultan Ahmed Sagor Format with UpperCasePipe ❖ Let us create a Hero class to hold all the information that hero can contain <h2>{{hero.name | uppercase}} Details</h2>
  • 39. Software IndustrySultan Ahmed Sagor Edit The hero ❖ Users should be able to edit the hero name in an <input> textbox. ❖ The textbox should both display the hero's name property and update that property as the user types. ❖ That means data flows from the component class out to the screen and from the screen back to the class. ❖ To automate that data flow, setup a two-way data binding between the <input> form element and the hero.name property.
  • 40. Software IndustrySultan Ahmed Sagor Two-Way Binding <div> <label>name: <input [(ngModel)]="hero.name" placeholder="name"/> </label> </div>
  • 41. Software IndustrySultan Ahmed Sagor The missing FormsModule ❖ Notice that the app stopped working when you added [(ngModel)]. ❖ To see the error, open the browser development tools and look in the console for a message like
  • 42. Software IndustrySultan Ahmed Sagor AppModule ❖ Angular needs to know how the pieces of your application fit together and what other files and libraries the app requires. This information is called metadata. ❖ Some of the metadata is in the @Component decorators that you added to your component classes. Other critical metadata is in @NgModule decorators. ❖ The most important @NgModule decorator annotates the top-level AppModule class. ❖ The Angular CLI generated an AppModule class in src/app/app.module.ts when it created the project. This is where you opt-in to the FormsModule.
  • 43. Software IndustrySultan Ahmed Sagor Import FormsModule ❖ Open AppModule (app.module.ts) and import the FormsModule symbol from the @angular/forms library. import { FormsModule } from '@angular/forms'; // <-- NgModel lives here ❖ Thenn add FormsModule to the @NgModule metadata's imports array, which contains a list of external modules that the app needs. imports: [ BrowserModule, FormsModule ],
  • 44. Software IndustrySultan Ahmed Sagor Declare the HeroesComponent ❖ Every component must be declared in exactly one NgModule. ❖ You didn't declare the HeroesComponent. So why did the application work? ❖ It worked because the Angular CLI declared HeroesComponent in the AppModule when it generated that component ❖ Open src/app/app.module.ts and find HeroesComponent imported near the top.
  • 45. Software IndustrySultan Ahmed Sagor Declare the HeroesComponent import { HeroesComponent } from './heroes/heroes.component'; ❖ The HeroesComponent is declared in the @NgModule.declarations array. declarations: [ AppComponent, HeroesComponent ],
  • 46. Software IndustrySultan Ahmed Sagor Any question?
  • 47. Software IndustrySultan Ahmed Sagor Thank You