SlideShare a Scribd company logo
1 of 16
Angular crash course
For working developers
Birhan Nega, march, 2022
Angular
● Angular is a framework and platform for building single-page apps".
● It is one of the big three frontend frameworks along with React and Vue.
● Its main building blocks include modules, services and components ,directives
● Modules have root modules and feature modules.
● Components have root components, templates, views, data binding, directives and pipes
● Services have providers and use dependency injection.
Terms to discuss
● Components
● Modules (root module, feature modules)
● Services
● View
● Template
● Data binding
● Directive
● pipes
Components
● Typescript class that interacts with a view.
● A view consists of a component and a template
● A template is HTML combined with the data-binding syntax of Angular
● The view gets updated these properties and methods in the class
1. selector: this is what your component will be in HTML
2. templateUrl: This is the view that corresponds to your template.providers:
Services
● It is an injectable class which handles actions like fetching data from the
server, changing state, validating user input, or logging directly to the
console.
● Services avoid rewriting of code.
● A service can be written once and injected into all the components that
use that service
● They have @Injectable()decorator so that any component can inject them
Dependency injection
● Dependency injection is used to provide components with the services they can use.
● To define a class as a service in Angular, the @Injectable() decorator is used.
● It provides the metadata that allows Angular to inject it into a component as a
dependency.
● In the longhand method, you register an object with two properties, provide and useValue, in the
providers array of any module
● For shorthand method we can add them in providers array of the component metadata
Modules
● a place where you can group the components, directives, pipes, and
services, which are related to the application
● Angular applications are modular and Angular has its own modularity
system called NgModules
● The idea of modules comes from the single responsibility principle.
● Organizing code into modules also allows lazy loading, meaning the
modules load as needed rather than all at once on application
initialization.
● Can be root module/ feature module
● Root Module is always one and it’s called AppModule by default
Modules meta-data
An Angular module has five properties that make up its metadata
● Declarations: We can list any directives, components, or pipes here that will need to
communicate with each other.
● Imports: Pulls in any modules like the forms or router modules.
● Exports: Makes components, pipes, and directives usable in other modules that import
this one.
● Providers: Services added here become known globally to allow for dependency
injection.
● Bootstrap: Only the root module has this property. This will contain the main application
view, also called the root component.
Lifecycle hooks
Angular has a lifecycle that starts when Angular instantiates the component
class and renders the component view along with its child views.
The life cycle continues with change detection, as Angular checks to see when
data-bound properties change, and updates both the view and the
component instance as needed.
The lifecycle ends when Angular destroys the component instance and
removes its rendered template from the DOM.
Directives have a similar life cycle, as Angular creates, updates, and destroys
instances in the course of execution.
Directives
Directives are classes that add additional behavior to elements in your
Angular applications
The different types of Angular directives are as follows:
Components—directives with a template. This type of directive is the most
common directive type.
Attribute directives—directives that change the appearance or behavior of an
element, component, or another directive.
Structural directives—directives that change the DOM layout by adding and
removing DOM elements
Observables
Observable services are patterns that allow you to effectively deal with data —
allowing you to parse, modify and maintain data in an event-based system.
You can’t really escape Http and Observables because everything is data
Routing, guards
● To handle the navigation from one view to the next, you use the Angular
Router.
● If you have a login of some sort, you’re going to need route guards.
● The idea that you can protect certain views from unauthorized views is a must-
have requirement in many applications.
● Route guards act as an interface between your router and the requested
route.
● lazy-loading can also enhance your user’s experience by speeding up your
application’s load time
Pipes
● Formatting data has never been easier with Angular pipes.
● While a lot of the pre-configured and out the box pipes covers a lot of
things like dates, currency, percentages and character casing, it doesn’t
cover everything that you’ll ever need.
● That’s where custom pipes come in handy. You can create your own filters
easily and transform data formats to your liking
Component to component communication
There are 3 different communications
● Parent to Child Communication
● Child to Parent Communication
● Interaction when there is no parent-child relation
Forms
Handling user input with forms is the cornerstone of many common
applications.
Applications use forms to enable users to log in, to update a profile, to enter
sensitive information, and to perform many other data-entry tasks.
Angular provides two different approaches to handling user input through
forms: reactive and template-driven.

More Related Content

What's hot

Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 

What's hot (20)

Chapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptxChapter 2 Flutter Basics Lecture 1.pptx
Chapter 2 Flutter Basics Lecture 1.pptx
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
SonarQube Presentation.pptx
SonarQube Presentation.pptxSonarQube Presentation.pptx
SonarQube Presentation.pptx
 
Angular 8
Angular 8 Angular 8
Angular 8
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Cross platform mobile application devlopment
Cross platform mobile application devlopmentCross platform mobile application devlopment
Cross platform mobile application devlopment
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Flutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter applicationFlutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter application
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
 
Flutter Session GDSC BPIT.pptx
Flutter Session GDSC BPIT.pptxFlutter Session GDSC BPIT.pptx
Flutter Session GDSC BPIT.pptx
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
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
 
Angular
AngularAngular
Angular
 
What is Flutter
What is FlutterWhat is Flutter
What is Flutter
 
Angular Routing Guard
Angular Routing GuardAngular Routing Guard
Angular Routing Guard
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
 
Flutter workshop
Flutter workshopFlutter workshop
Flutter workshop
 
UX Experience Design: Processes and Strategy
UX Experience Design: Processes and StrategyUX Experience Design: Processes and Strategy
UX Experience Design: Processes and Strategy
 
Android studio ppt
Android studio pptAndroid studio ppt
Android studio ppt
 
Flutter
FlutterFlutter
Flutter
 

Similar to Angular crash course

Angular Course.pptx
Angular Course.pptxAngular Course.pptx
Angular Course.pptx
Imdad Ullah
 

Similar to Angular crash course (20)

Introduction to Angular2
Introduction to Angular2Introduction to Angular2
Introduction to Angular2
 
17612235.ppt
17612235.ppt17612235.ppt
17612235.ppt
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with Angular
 
Angular Interview Question & Answers PDF By ScholarHat
Angular Interview Question & Answers PDF By ScholarHatAngular Interview Question & Answers PDF By ScholarHat
Angular Interview Question & Answers PDF By ScholarHat
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
Angular Course.pptx
Angular Course.pptxAngular Course.pptx
Angular Course.pptx
 
What is Angular?
What is Angular?What is Angular?
What is Angular?
 
Angular Framework.pptx
Angular Framework.pptxAngular Framework.pptx
Angular Framework.pptx
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
Angular2
Angular2Angular2
Angular2
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
Angularjs basic part01
Angularjs basic part01Angularjs basic part01
Angularjs basic part01
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha GadkariAngular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
 
What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
Angular 9
Angular 9 Angular 9
Angular 9
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Angular crash course

  • 1. Angular crash course For working developers Birhan Nega, march, 2022
  • 2. Angular ● Angular is a framework and platform for building single-page apps". ● It is one of the big three frontend frameworks along with React and Vue. ● Its main building blocks include modules, services and components ,directives ● Modules have root modules and feature modules. ● Components have root components, templates, views, data binding, directives and pipes ● Services have providers and use dependency injection.
  • 3. Terms to discuss ● Components ● Modules (root module, feature modules) ● Services ● View ● Template ● Data binding ● Directive ● pipes
  • 4. Components ● Typescript class that interacts with a view. ● A view consists of a component and a template ● A template is HTML combined with the data-binding syntax of Angular ● The view gets updated these properties and methods in the class 1. selector: this is what your component will be in HTML 2. templateUrl: This is the view that corresponds to your template.providers:
  • 5.
  • 6. Services ● It is an injectable class which handles actions like fetching data from the server, changing state, validating user input, or logging directly to the console. ● Services avoid rewriting of code. ● A service can be written once and injected into all the components that use that service ● They have @Injectable()decorator so that any component can inject them
  • 7. Dependency injection ● Dependency injection is used to provide components with the services they can use. ● To define a class as a service in Angular, the @Injectable() decorator is used. ● It provides the metadata that allows Angular to inject it into a component as a dependency. ● In the longhand method, you register an object with two properties, provide and useValue, in the providers array of any module ● For shorthand method we can add them in providers array of the component metadata
  • 8. Modules ● a place where you can group the components, directives, pipes, and services, which are related to the application ● Angular applications are modular and Angular has its own modularity system called NgModules ● The idea of modules comes from the single responsibility principle. ● Organizing code into modules also allows lazy loading, meaning the modules load as needed rather than all at once on application initialization. ● Can be root module/ feature module ● Root Module is always one and it’s called AppModule by default
  • 9. Modules meta-data An Angular module has five properties that make up its metadata ● Declarations: We can list any directives, components, or pipes here that will need to communicate with each other. ● Imports: Pulls in any modules like the forms or router modules. ● Exports: Makes components, pipes, and directives usable in other modules that import this one. ● Providers: Services added here become known globally to allow for dependency injection. ● Bootstrap: Only the root module has this property. This will contain the main application view, also called the root component.
  • 10. Lifecycle hooks Angular has a lifecycle that starts when Angular instantiates the component class and renders the component view along with its child views. The life cycle continues with change detection, as Angular checks to see when data-bound properties change, and updates both the view and the component instance as needed. The lifecycle ends when Angular destroys the component instance and removes its rendered template from the DOM. Directives have a similar life cycle, as Angular creates, updates, and destroys instances in the course of execution.
  • 11. Directives Directives are classes that add additional behavior to elements in your Angular applications The different types of Angular directives are as follows: Components—directives with a template. This type of directive is the most common directive type. Attribute directives—directives that change the appearance or behavior of an element, component, or another directive. Structural directives—directives that change the DOM layout by adding and removing DOM elements
  • 12. Observables Observable services are patterns that allow you to effectively deal with data — allowing you to parse, modify and maintain data in an event-based system. You can’t really escape Http and Observables because everything is data
  • 13. Routing, guards ● To handle the navigation from one view to the next, you use the Angular Router. ● If you have a login of some sort, you’re going to need route guards. ● The idea that you can protect certain views from unauthorized views is a must- have requirement in many applications. ● Route guards act as an interface between your router and the requested route. ● lazy-loading can also enhance your user’s experience by speeding up your application’s load time
  • 14. Pipes ● Formatting data has never been easier with Angular pipes. ● While a lot of the pre-configured and out the box pipes covers a lot of things like dates, currency, percentages and character casing, it doesn’t cover everything that you’ll ever need. ● That’s where custom pipes come in handy. You can create your own filters easily and transform data formats to your liking
  • 15. Component to component communication There are 3 different communications ● Parent to Child Communication ● Child to Parent Communication ● Interaction when there is no parent-child relation
  • 16. Forms Handling user input with forms is the cornerstone of many common applications. Applications use forms to enable users to log in, to update a profile, to enter sensitive information, and to perform many other data-entry tasks. Angular provides two different approaches to handling user input through forms: reactive and template-driven.

Editor's Notes

  1. Read more here angular life cycle hooks