SlideShare a Scribd company logo
1 of 43
Angular Kickstart
Prerequisites
2
What is Angular :
 Angular is a client side JavaScript framework.
 It is allows you to create modern Single Page Application.
 Released in Sep 2016.
 Developed and maintained by Google.
 We can build large scale and high performance web application.
 In-built services and plug-in which useful for develop web app.
 Customize and create own plug-in, directives and services.
 Major version will be released every six months.
What is Single Page Application:
 In Traditional website, content is organized on individual pages that are usually
static.
 When user performs some action it will load entire page.
 But in SPA website all the pages and content will load only once when user first
views the application.
 After that when ever user performs any action, instead of loading entire page it
will load only the content.
Traditional website SPA website
What is a SPA? ( Contd.,)
Source: http://jpapa.me/wikispa
a single page application literally has only one page !!
Why a SPA?
• Rich Interface ( no constant full page reloads)
• Reaching Multiple Devices
• Responsive
• Portable
Angular and Its Releases
7
Angular JS Vs Angular - Architecture
8
Angular JS Vs Angular – Architecture( Contd.,)
9
Angular JS Vs Angular - Language
10
Typescript
ES 2015
ES 5
Angular JS Vs Angular – Expression Syntax
11
Angular JS Vs Angular – Mobile
12
Angular JS Vs Angular – Routing
13
Angular JS Vs Angular – Advantages
14
Key Changes
Angular 1.x Angular 2.0
Controllers Components
Views Templates
Directives Simplified Directives
Two Way Data Binding
One & Two Way Data
Binding
$Scope No Scope
Features :
 Modularity
 Adding new feature module without changing the overall code base.
 Speed and Performance
 Using Routing concept which split the code allowing users to load only
relevant code required for the rendering the requested view.
 TypeScript
 TypeScript is superset of JavaScript. Coding is written in ES6 and
converted to ES5.
What do we need to start Angular apps:
 Editor:
 We need to have an editor for developing or writing your angular scripts and which
supports TypeScript. Ex: Visual Studio Code
 Browser:
 Of course we are developing web app so we need a Browser. Ex: Google Chrome.
 Node / npm:
 We need node and npm (Node Package Manager) to be installed in your machine.
 Angular CLI:
 The Angular CLI is a command line interface tool that can create a project, add files,
and perform a variety of ongoing development tasks such as testing, bundling, and
deployment.
 JS Task Runnser / Bundling: Grunt, Gulp and Webpack etc.
 Unit Testing: Karma, Jasmine etc.
 Linting: If you like to have coding standards you can use linting.
Why Node JS and Npm
“Angular” is entirely new framework and it is (Angular or Angular 2
and above) written in Typescript. Browser does not understand Typescript JS
(i.e., .ts) we need to compile them in plain JavaScript i.e., .js.
We need to use Node and NPM compile them into js file so that we
can deploy them in production.
Most of the Angular packages or libraries at GitHub repository
(github.com/angular/angular) are distributed as different NPM
packages. Node Package Manager(NPM) is heavily dependent on
Node.js.
 You do not need to use Node anywhere in production server to use front-end
JavaScript frameworks like Angular or react etc.
18
Set up the dev environment:
 STEP 1 : Install NodeJS, npm and Angular CLI:
 You need to set up your development environment before you can do anything.
 Install Node.js and npm if they are not already on your machine.
 Verify that you are running at least Node.js version 8.x or greater and npm
version 5.x or greater by running node -v and npm -v in a terminal/console
window. Older versions produce errors, but newer versions are fine.
 Then install the Angular CLI globally.
 STEP 2 : Create a new project :
 Open a terminal window.
 Generate a new project and default app by running the following command:
 The Angular CLI installs the necessary npm packages, creates the project
files, and populates the project with a simple default app. This can take some
time.
Set up the dev
environment(Contd.,)
 Step 3: Serve the application :
 Go to the project directory and launch the server.
 The ng serve command launches the server, watches your files, and rebuilds the
app as you make changes to those files.
 Using the --open (or just -o) option will automatically open your browser
on http://localhost:4200/.
 Your app greets you with a message:
Project File Review:
 The first file you should check out is README.md. It has some basic information on
how to use CLI commands.
 The src folder:
 Your app lives in the src folder.
 All Angular components, templates, styles, images, and anything else your app needs go here.
 Any files outside of this folder are meant to support building your app.
 The root folder :
 The src/ folder is just one of the items inside the project's root folder.
 Other files help you build, test, maintain, document, and deploy the app.
 These files go in the root folder next to src/.
Project File Review: ( src folder)
• Defines the AppComponent along with an
• HTML template, CSS stylesheet, and a unit test.
• It is the root component of what will become a tree
of nested components as the application evolves.
• Defines AppModule, the root module that tells
Angular how to assemble the application.
• Right now it declares only the AppComponent. Soon
there will be more components to declare.
• A folder where you can put images and anything else to
be copied wholesale when you build your application.
• The main HTML page that is served when someone
visits your site.
• Most of the time you'll never need to edit it.
• The CLI automatically adds all js and css files when
building your app so you never need to add any
<script> or <link> tags here manually.
•The main entry point for your app. Compiles the
application with the JIT compilerand bootstraps the
application's root module (AppModule) to run in the
browser. You can also use the AOT compiler without
changing any code by appending the--aotflag to the ng
build and ng serve commands.
Project File Review: ( root folder)
• Node.js creates this folder and puts all third party
modules listed in package.json inside of it.
• Configuration for Angular CLI.
• In this file you can set several defaults and also configure
what files are included when your project is built.•npm configuration listing the third party packages your
project uses. You can also add your own custom
scripts here.
Application
24
Component
25
Module
26
Building Blocks of Angular:
Modules
Components
Templates
Metadata
Data binding
Directives
Services
Dependency Injection
Routing
Angular 2 & above - Architecture
28
Angular Modules:
 Just a way of bringing various parts of Angular App into a single unit.
 Typical Angular Module structure.
 A class could be marked with “export”.
 @NgModule decorator.
 Decorator decorates (marks) class as a “Angular Module”.
 Contains additional info (metadata).
 Feature imports from other modules.
 Angular App contains at least one module.
 Usually called as “Root Module”.
 And also called as “AppModule”.
 Angular App can contains multiple module which is called as feature modules.
 Usually these modules connected to “AppModule”.
 Each module is responsible for a specific business or feature of Angular app.
Angular Components:
 Fundamental building-block of UI.
 Component contains UI and related logic.
 It is combination of 3 parts.
 Typical Angular Component structure.
 A class could be marked with “export”.
 Provides data to UI.
 Handles the events from UI.
 @Component decorator.
 Decorator decorates (marks) class as a “Angular Component”.
 Defines UI Template / View.
 Contains additional info (metadata).
 Feature imports from other modules.
 Angular App contains at least one component.
 Usually called as “Root Component”.
 And also called as “AppComponent”.
 Angular components can be nested and need to be included in AppModule in order
to make them work.
 Root module (AppModule) can start the Root Component (AppComponent).
Angular Templates:
 A template is nothing but a form of HTML tags that tells Angular about how to render
the component.
 A template looks like regular HTML, except for a few differences.
Metadata:
 Metadata tells Angular how to process a class.
 In TypeScript, you attach metadata by using a decorator.
 selector: selector tells Angular to create and insert an instance of this component
where it finds <app-hero-list>
 templateUrl: It contains the path of this component’s HTML template.
 providers: An array of dependency injection providers for services that the
component requires.
Data Binding:
 Interpolation ( {{...}} ) : You use interpolation to strings into the text between HTML
element tags and within attribute assignments.
 Property binding ( [property] ) : The Write a template property binding to set a
property of a view element. The binding sets the property to the value of a template
expression.
 Event binding ( (event) ) : The only way to know about a user action is to listen for
certain events such as keystrokes, mouse movements, clicks, and touches. You
declare your interest in user actions through Angular event binding.
 Two-way binding ( [(...)] ) : When developing data entry forms, you often both display
a data property and update that property when the user makes changes.
Data Binding ( Contd.,)
Directives:
 Angular templates are dynamic. When Angular renders them, it transforms the DOM
according to the instructions given by directives.
 A directive is a class with a @Directive decorator.
 A component is a directive-with-a-template;
 @Component decorator is actually a @Directive decorator extended with template-
oriented features.
 While a component is technically a directive, components are so distinctive and
central to Angular applications that this architectural overview separates components
from directives.
 Two other kinds of directives exist: Structural and Attribute directives.
Directives:
 Structural directives alter layout by adding, removing, and replacing elements in DOM.
 This example template uses two built-in structural directives:
 *ngFor tells Angular to retrieve one <li> per movie in the movies
 *ngIf includes the MovieDetail component only if a selected movie exists.
Directives:
 Attribute directives alter the appearance or behavior of an existing element.
 In templates, they look like regular HTML attributes.
 The ngModel directive, which implements two-way data binding, is an example of an attribute
directive.
 Angular has a few more directives that either alter the layout structure (for example, ngSwitch)
 Modify aspects of DOM elements and components (for example, ngStyle and ngClass).
Dependency Injection:
 Dependency injection is a way to supply a new instance of a class with the fully-formed
dependencies it requires.
 Most dependencies are services. Angular uses dependency injection to provide new
components with the services they need.
 Angular can tell which services a component needs by looking at the types of its
constructor parameters.
 When Angular creates a component, it first asks an injector for the services that the
component requires.
Dependency Injection:
 We can register any service in provider property inside metadata.
 Provider is something that can create or return a service, typically the service class
itself.
 You can register providers in modules or in components.
 In general, add providers to the root module so that the same instance of a service is
available everywhere.
 Alternatively, you can register a service at a component level in the providers property
of the @Component decorator.
Routing:
 The Angular Router enables navigation from one view to the next as users perform
application tasks.
 Set the <base href> :
 You must add a <base href> element to the app's index.html for pushState routing to work.
 Add the <base> element just after the <head> tag.
 Add routes :
 Routes tell the router which view to display when a user clicks a link or pastes a URL into the
browser address bar.
 A typical Angular Route has two properties:
 path: a string that matches the URL in the browser address bar.
 component: the component that the router should create when navigating to this route.
 Once you've finished setting up, the router will match that URL to path: 'heroes' and display
the HeroesComponent.
Routing:
 RouterModule.forRoot( ) :
 You first must initialize the router and start it listening for browser location changes.
 Add RouterModule to the @NgModule.imports array and configure it with the routes in one
step by calling RouterModule.forRoot( ) within the imports array, like this:
 The method is called forRoot() because you configure the router at the application's root level.
The forRoot() method supplies the service providers and directives needed for routing, and
performs the initial navigation based on the current browser URL..
 Add RouterOutlet :
 Open the AppComponent template and add <router-outlet> element.
 The <router-outlet> tells the router where to display routed views.
 The RouterOutlet is one of the router directives that became available to the AppComponent
because AppModule imports AppRoutingModule which exported RouterModule.
Reference:
 https://angular.io
 https://material.angular.io/guide/getting-started
 https://nodejs.org/en/
 https://code.visualstudio.com/download
Any Questions ?

More Related Content

What's hot

What's hot (20)

Sharing Data Between Angular Components
Sharing Data Between Angular ComponentsSharing Data Between Angular Components
Sharing Data Between Angular Components
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
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
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
Angular
AngularAngular
Angular
 
Angular 5 presentation for beginners
Angular 5 presentation for beginnersAngular 5 presentation for beginners
Angular 5 presentation for beginners
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
AngularJS
AngularJS AngularJS
AngularJS
 
Angular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdfAngular Interview Questions-PDF.pdf
Angular Interview Questions-PDF.pdf
 
Angular components
Angular componentsAngular components
Angular components
 
Angular material
Angular materialAngular material
Angular material
 
Introduzione ad angular 7/8
Introduzione ad angular 7/8Introduzione ad angular 7/8
Introduzione ad angular 7/8
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
 
Angular Routing Guard
Angular Routing GuardAngular Routing Guard
Angular Routing Guard
 
AngularJS for Beginners
AngularJS for BeginnersAngularJS for Beginners
AngularJS for Beginners
 

Similar to Angular kickstart slideshare

4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
tilejak773
 

Similar to Angular kickstart slideshare (20)

How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
 
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
 
Angular4 getting started
Angular4 getting startedAngular4 getting started
Angular4 getting started
 
Angular IO
Angular IOAngular IO
Angular IO
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Angular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web ApplicationsAngular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web Applications
 
Introduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setupIntroduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setup
 
Introduction To Angular 4 - J2I
Introduction To Angular 4 - J2IIntroduction To Angular 4 - J2I
Introduction To Angular 4 - J2I
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
4 Anguadasdfasdasdfasdfsdfasdfaslar (1).pptx
 
Angularjs2 presentation
Angularjs2 presentationAngularjs2 presentation
Angularjs2 presentation
 
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
 
Angular Js
Angular JsAngular Js
Angular Js
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 sch
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
Angular js getting started
Angular js getting startedAngular js getting started
Angular js getting started
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 
Intro to AngularJS
Intro to AngularJS Intro to AngularJS
Intro to AngularJS
 
Integrating TypeScript with popular frameworks like React or Angular.pdf
Integrating TypeScript with popular frameworks like React or Angular.pdfIntegrating TypeScript with popular frameworks like React or Angular.pdf
Integrating TypeScript with popular frameworks like React or Angular.pdf
 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Recently uploaded (20)

University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

Angular kickstart slideshare

  • 3. What is Angular :  Angular is a client side JavaScript framework.  It is allows you to create modern Single Page Application.  Released in Sep 2016.  Developed and maintained by Google.  We can build large scale and high performance web application.  In-built services and plug-in which useful for develop web app.  Customize and create own plug-in, directives and services.  Major version will be released every six months.
  • 4. What is Single Page Application:  In Traditional website, content is organized on individual pages that are usually static.  When user performs some action it will load entire page.  But in SPA website all the pages and content will load only once when user first views the application.  After that when ever user performs any action, instead of loading entire page it will load only the content. Traditional website SPA website
  • 5. What is a SPA? ( Contd.,) Source: http://jpapa.me/wikispa a single page application literally has only one page !!
  • 6. Why a SPA? • Rich Interface ( no constant full page reloads) • Reaching Multiple Devices • Responsive • Portable
  • 7. Angular and Its Releases 7
  • 8. Angular JS Vs Angular - Architecture 8
  • 9. Angular JS Vs Angular – Architecture( Contd.,) 9
  • 10. Angular JS Vs Angular - Language 10 Typescript ES 2015 ES 5
  • 11. Angular JS Vs Angular – Expression Syntax 11
  • 12. Angular JS Vs Angular – Mobile 12
  • 13. Angular JS Vs Angular – Routing 13
  • 14. Angular JS Vs Angular – Advantages 14
  • 15. Key Changes Angular 1.x Angular 2.0 Controllers Components Views Templates Directives Simplified Directives Two Way Data Binding One & Two Way Data Binding $Scope No Scope
  • 16. Features :  Modularity  Adding new feature module without changing the overall code base.  Speed and Performance  Using Routing concept which split the code allowing users to load only relevant code required for the rendering the requested view.  TypeScript  TypeScript is superset of JavaScript. Coding is written in ES6 and converted to ES5.
  • 17. What do we need to start Angular apps:  Editor:  We need to have an editor for developing or writing your angular scripts and which supports TypeScript. Ex: Visual Studio Code  Browser:  Of course we are developing web app so we need a Browser. Ex: Google Chrome.  Node / npm:  We need node and npm (Node Package Manager) to be installed in your machine.  Angular CLI:  The Angular CLI is a command line interface tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.  JS Task Runnser / Bundling: Grunt, Gulp and Webpack etc.  Unit Testing: Karma, Jasmine etc.  Linting: If you like to have coding standards you can use linting.
  • 18. Why Node JS and Npm “Angular” is entirely new framework and it is (Angular or Angular 2 and above) written in Typescript. Browser does not understand Typescript JS (i.e., .ts) we need to compile them in plain JavaScript i.e., .js. We need to use Node and NPM compile them into js file so that we can deploy them in production. Most of the Angular packages or libraries at GitHub repository (github.com/angular/angular) are distributed as different NPM packages. Node Package Manager(NPM) is heavily dependent on Node.js.  You do not need to use Node anywhere in production server to use front-end JavaScript frameworks like Angular or react etc. 18
  • 19. Set up the dev environment:  STEP 1 : Install NodeJS, npm and Angular CLI:  You need to set up your development environment before you can do anything.  Install Node.js and npm if they are not already on your machine.  Verify that you are running at least Node.js version 8.x or greater and npm version 5.x or greater by running node -v and npm -v in a terminal/console window. Older versions produce errors, but newer versions are fine.  Then install the Angular CLI globally.  STEP 2 : Create a new project :  Open a terminal window.  Generate a new project and default app by running the following command:  The Angular CLI installs the necessary npm packages, creates the project files, and populates the project with a simple default app. This can take some time.
  • 20. Set up the dev environment(Contd.,)  Step 3: Serve the application :  Go to the project directory and launch the server.  The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.  Using the --open (or just -o) option will automatically open your browser on http://localhost:4200/.  Your app greets you with a message:
  • 21. Project File Review:  The first file you should check out is README.md. It has some basic information on how to use CLI commands.  The src folder:  Your app lives in the src folder.  All Angular components, templates, styles, images, and anything else your app needs go here.  Any files outside of this folder are meant to support building your app.  The root folder :  The src/ folder is just one of the items inside the project's root folder.  Other files help you build, test, maintain, document, and deploy the app.  These files go in the root folder next to src/.
  • 22. Project File Review: ( src folder) • Defines the AppComponent along with an • HTML template, CSS stylesheet, and a unit test. • It is the root component of what will become a tree of nested components as the application evolves. • Defines AppModule, the root module that tells Angular how to assemble the application. • Right now it declares only the AppComponent. Soon there will be more components to declare. • A folder where you can put images and anything else to be copied wholesale when you build your application. • The main HTML page that is served when someone visits your site. • Most of the time you'll never need to edit it. • The CLI automatically adds all js and css files when building your app so you never need to add any <script> or <link> tags here manually. •The main entry point for your app. Compiles the application with the JIT compilerand bootstraps the application's root module (AppModule) to run in the browser. You can also use the AOT compiler without changing any code by appending the--aotflag to the ng build and ng serve commands.
  • 23. Project File Review: ( root folder) • Node.js creates this folder and puts all third party modules listed in package.json inside of it. • Configuration for Angular CLI. • In this file you can set several defaults and also configure what files are included when your project is built.•npm configuration listing the third party packages your project uses. You can also add your own custom scripts here.
  • 27. Building Blocks of Angular: Modules Components Templates Metadata Data binding Directives Services Dependency Injection Routing
  • 28. Angular 2 & above - Architecture 28
  • 29. Angular Modules:  Just a way of bringing various parts of Angular App into a single unit.  Typical Angular Module structure.  A class could be marked with “export”.  @NgModule decorator.  Decorator decorates (marks) class as a “Angular Module”.  Contains additional info (metadata).  Feature imports from other modules.  Angular App contains at least one module.  Usually called as “Root Module”.  And also called as “AppModule”.  Angular App can contains multiple module which is called as feature modules.  Usually these modules connected to “AppModule”.  Each module is responsible for a specific business or feature of Angular app.
  • 30. Angular Components:  Fundamental building-block of UI.  Component contains UI and related logic.  It is combination of 3 parts.  Typical Angular Component structure.  A class could be marked with “export”.  Provides data to UI.  Handles the events from UI.  @Component decorator.  Decorator decorates (marks) class as a “Angular Component”.  Defines UI Template / View.  Contains additional info (metadata).  Feature imports from other modules.  Angular App contains at least one component.  Usually called as “Root Component”.  And also called as “AppComponent”.  Angular components can be nested and need to be included in AppModule in order to make them work.  Root module (AppModule) can start the Root Component (AppComponent).
  • 31. Angular Templates:  A template is nothing but a form of HTML tags that tells Angular about how to render the component.  A template looks like regular HTML, except for a few differences.
  • 32. Metadata:  Metadata tells Angular how to process a class.  In TypeScript, you attach metadata by using a decorator.  selector: selector tells Angular to create and insert an instance of this component where it finds <app-hero-list>  templateUrl: It contains the path of this component’s HTML template.  providers: An array of dependency injection providers for services that the component requires.
  • 33. Data Binding:  Interpolation ( {{...}} ) : You use interpolation to strings into the text between HTML element tags and within attribute assignments.  Property binding ( [property] ) : The Write a template property binding to set a property of a view element. The binding sets the property to the value of a template expression.  Event binding ( (event) ) : The only way to know about a user action is to listen for certain events such as keystrokes, mouse movements, clicks, and touches. You declare your interest in user actions through Angular event binding.  Two-way binding ( [(...)] ) : When developing data entry forms, you often both display a data property and update that property when the user makes changes.
  • 34. Data Binding ( Contd.,)
  • 35. Directives:  Angular templates are dynamic. When Angular renders them, it transforms the DOM according to the instructions given by directives.  A directive is a class with a @Directive decorator.  A component is a directive-with-a-template;  @Component decorator is actually a @Directive decorator extended with template- oriented features.  While a component is technically a directive, components are so distinctive and central to Angular applications that this architectural overview separates components from directives.  Two other kinds of directives exist: Structural and Attribute directives.
  • 36. Directives:  Structural directives alter layout by adding, removing, and replacing elements in DOM.  This example template uses two built-in structural directives:  *ngFor tells Angular to retrieve one <li> per movie in the movies  *ngIf includes the MovieDetail component only if a selected movie exists.
  • 37. Directives:  Attribute directives alter the appearance or behavior of an existing element.  In templates, they look like regular HTML attributes.  The ngModel directive, which implements two-way data binding, is an example of an attribute directive.  Angular has a few more directives that either alter the layout structure (for example, ngSwitch)  Modify aspects of DOM elements and components (for example, ngStyle and ngClass).
  • 38. Dependency Injection:  Dependency injection is a way to supply a new instance of a class with the fully-formed dependencies it requires.  Most dependencies are services. Angular uses dependency injection to provide new components with the services they need.  Angular can tell which services a component needs by looking at the types of its constructor parameters.  When Angular creates a component, it first asks an injector for the services that the component requires.
  • 39. Dependency Injection:  We can register any service in provider property inside metadata.  Provider is something that can create or return a service, typically the service class itself.  You can register providers in modules or in components.  In general, add providers to the root module so that the same instance of a service is available everywhere.  Alternatively, you can register a service at a component level in the providers property of the @Component decorator.
  • 40. Routing:  The Angular Router enables navigation from one view to the next as users perform application tasks.  Set the <base href> :  You must add a <base href> element to the app's index.html for pushState routing to work.  Add the <base> element just after the <head> tag.  Add routes :  Routes tell the router which view to display when a user clicks a link or pastes a URL into the browser address bar.  A typical Angular Route has two properties:  path: a string that matches the URL in the browser address bar.  component: the component that the router should create when navigating to this route.  Once you've finished setting up, the router will match that URL to path: 'heroes' and display the HeroesComponent.
  • 41. Routing:  RouterModule.forRoot( ) :  You first must initialize the router and start it listening for browser location changes.  Add RouterModule to the @NgModule.imports array and configure it with the routes in one step by calling RouterModule.forRoot( ) within the imports array, like this:  The method is called forRoot() because you configure the router at the application's root level. The forRoot() method supplies the service providers and directives needed for routing, and performs the initial navigation based on the current browser URL..  Add RouterOutlet :  Open the AppComponent template and add <router-outlet> element.  The <router-outlet> tells the router where to display routed views.  The RouterOutlet is one of the router directives that became available to the AppComponent because AppModule imports AppRoutingModule which exported RouterModule.
  • 42. Reference:  https://angular.io  https://material.angular.io/guide/getting-started  https://nodejs.org/en/  https://code.visualstudio.com/download

Editor's Notes

  1. Source: Image captured from Pluralsight
  2. Source : http://oniwebblog.blogspot.com/2016/01/angularjs-create-web-site-using.html http://angular.io
  3. Source : https://www.simplilearn.com/angularjs-vs-angular-2-vs-angular-4-differences-article https://developer.telerik.com/featured/19-tips-to-make-learning-angular-2-easier/
  4. Pic : Taken from PS
  5. Pic : Taken from PS