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 8
Angular 8 Angular 8
Angular 8
Sunil OS
 
Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
Eyal Vardi
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
Angular
AngularAngular
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
Malla Reddy University
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
ritika1
 
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
WebStackAcademy
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
Angular Lifecycle Hooks
Angular Lifecycle HooksAngular Lifecycle Hooks
Angular Lifecycle Hooks
Squash Apps Pvt Ltd
 
Angular routing
Angular routingAngular routing
Angular routing
Sultan Ahmed
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Maulik Shah
 
Angular
AngularAngular
Angular
khoado2002
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
Knoldus Inc.
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
Rob Eisenberg
 
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App Presentation
Elizabeth Long
 

What's hot (20)

Angular 8
Angular 8 Angular 8
Angular 8
 
Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Angular
AngularAngular
Angular
 
Angular Directives
Angular DirectivesAngular Directives
Angular Directives
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).ppt
 
ES6 presentation
ES6 presentationES6 presentation
ES6 presentation
 
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
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
Angular Lifecycle Hooks
Angular Lifecycle HooksAngular Lifecycle Hooks
Angular Lifecycle Hooks
 
Angular routing
Angular routingAngular routing
Angular routing
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
 
Angular
AngularAngular
Angular
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
Angular App Presentation
Angular App PresentationAngular App Presentation
Angular App Presentation
 

Similar to Angular components

Angular data binding
Angular data binding Angular data binding
Angular data binding
Sultan Ahmed
 
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
 
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
connectwebex
 

Similar to Angular components (20)

Angular data binding
Angular data binding Angular data binding
Angular data binding
 
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
 
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

Certified Quality Engineer.PREVIEW .pdf
Certified Quality Engineer.PREVIEW   .pdfCertified Quality Engineer.PREVIEW   .pdf
Certified Quality Engineer.PREVIEW .pdf
GAFM ACADEMY
 
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdfISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
MohammadAdnan6667
 
DETAILED ADVT FOR MT 2024. for fertilizer psupdf
DETAILED ADVT FOR MT 2024. for fertilizer psupdfDETAILED ADVT FOR MT 2024. for fertilizer psupdf
DETAILED ADVT FOR MT 2024. for fertilizer psupdf
BhavaniMishra
 
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model SafeDwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
kumkum tuteja$A17
 
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model SafeVaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
bookmybebe1
 
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model SafeGreater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
binna singh$A17
 
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model SafeLajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
shoeb2926
 
Certified Quality Engineer CQE .pdf
Certified Quality Engineer CQE       .pdfCertified Quality Engineer CQE       .pdf
Certified Quality Engineer CQE .pdf
GAFM ACADEMY
 
一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理
u8qzove
 
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model SafeKarol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
butwhat24
 
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptxRissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
ashishkumarrana9
 
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model SafeRK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
anchal singh$A17
 
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model SafeDaryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
Alisha Pathan $A17
 
de-on-thi-vstep-bac-4.pdfcscwscscscscscsc
de-on-thi-vstep-bac-4.pdfcscwscscscscscscde-on-thi-vstep-bac-4.pdfcscwscscscscscsc
de-on-thi-vstep-bac-4.pdfcscwscscscscscsc
92nqjwr76x
 
Pakistan Railways Jobs 2024 in Islamabad
Pakistan Railways Jobs 2024 in IslamabadPakistan Railways Jobs 2024 in Islamabad
Pakistan Railways Jobs 2024 in Islamabad
blog
 
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model SafeConnaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
tinakumariji156
 
Career Paths as Civil Graduate in the Era of Digital Transformation
Career Paths as Civil Graduate in the Era of Digital TransformationCareer Paths as Civil Graduate in the Era of Digital Transformation
Career Paths as Civil Graduate in the Era of Digital Transformation
Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career FairreStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
Ken Fuller
 
The Certified Planning Engineer.PREVIEW.pdf
The Certified Planning Engineer.PREVIEW.pdfThe Certified Planning Engineer.PREVIEW.pdf
The Certified Planning Engineer.PREVIEW.pdf
GAFM ACADEMY
 
This is a copy of usama's writing portfolio.pdf
This is a copy of usama's writing portfolio.pdfThis is a copy of usama's writing portfolio.pdf
This is a copy of usama's writing portfolio.pdf
Usama154639
 

Recently uploaded (20)

Certified Quality Engineer.PREVIEW .pdf
Certified Quality Engineer.PREVIEW   .pdfCertified Quality Engineer.PREVIEW   .pdf
Certified Quality Engineer.PREVIEW .pdf
 
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdfISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
ISB_GRADE_XI_AND_XII_ORIENTATION_PPT AY 2024-2025.pdf
 
DETAILED ADVT FOR MT 2024. for fertilizer psupdf
DETAILED ADVT FOR MT 2024. for fertilizer psupdfDETAILED ADVT FOR MT 2024. for fertilizer psupdf
DETAILED ADVT FOR MT 2024. for fertilizer psupdf
 
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model SafeDwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
Dwarka @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Vishakha Singla Top Model Safe
 
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model SafeVaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Vaishali @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
 
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model SafeGreater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
Greater Noida @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Yogita Mehra Top Model Safe
 
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model SafeLajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
Lajpat Nagar @ℂall @Girls ꧁❤ 9873777170 ❤꧂Glamorous sonam Mehra Top Model Safe
 
Certified Quality Engineer CQE .pdf
Certified Quality Engineer CQE       .pdfCertified Quality Engineer CQE       .pdf
Certified Quality Engineer CQE .pdf
 
一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理一比一原版(london毕业证书)伦敦大学毕业证如何办理
一比一原版(london毕业证书)伦敦大学毕业证如何办理
 
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model SafeKarol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
Karol Bagh @ℂall @Girls ꧁❤ 9873940964 ❤꧂VIP Jina Singh Top Model Safe
 
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptxRissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
Rissa May at 19_ A Rising Star in Entertainment and Environmental Activism.pptx
 
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model SafeRK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
RK Puram @ℂall @Girls ꧁❤ 9711199012 ❤꧂Fabulous sonam Mehra Top Model Safe
 
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model SafeDaryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
Daryaganj @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Neha Singla Top Model Safe
 
de-on-thi-vstep-bac-4.pdfcscwscscscscscsc
de-on-thi-vstep-bac-4.pdfcscwscscscscscscde-on-thi-vstep-bac-4.pdfcscwscscscscscsc
de-on-thi-vstep-bac-4.pdfcscwscscscscscsc
 
Pakistan Railways Jobs 2024 in Islamabad
Pakistan Railways Jobs 2024 in IslamabadPakistan Railways Jobs 2024 in Islamabad
Pakistan Railways Jobs 2024 in Islamabad
 
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model SafeConnaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
Connaught Place @ℂall @Girls ꧁❤ 9873777170 ❤꧂VIP Jya Khan Top Model Safe
 
Career Paths as Civil Graduate in the Era of Digital Transformation
Career Paths as Civil Graduate in the Era of Digital TransformationCareer Paths as Civil Graduate in the Era of Digital Transformation
Career Paths as Civil Graduate in the Era of Digital Transformation
 
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career FairreStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
reStartEvents Nationwide TS/SCI & Above Cleared Virtual Career Fair
 
The Certified Planning Engineer.PREVIEW.pdf
The Certified Planning Engineer.PREVIEW.pdfThe Certified Planning Engineer.PREVIEW.pdf
The Certified Planning Engineer.PREVIEW.pdf
 
This is a copy of usama's writing portfolio.pdf
This is a copy of usama's writing portfolio.pdfThis is a copy of usama's writing portfolio.pdf
This is a copy of usama's writing portfolio.pdf
 

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