SlideShare a Scribd company logo
presented by
Paras Mendiratta
1. Introduction
Introduction
“Angular is a Javascript Framework which allows you to create reactive
Single-Page-Applications (SPAs)”
3
Features
Cross Platform
➡ Progressive Web Apps
➡ Native Mobile Apps
➡ Desktop
Speed and Performance
➡ Code Generation
➡ Universal
➡ Code Splitting
4
Features
Productivity
➡ Templates
➡ Angular CLI
➡ IDEs
Full Development Story
➡ Testing
➡ Animation
➡ Accessibility
5
2. Comparison
Angular JS2 Training Session #1
Angular JS2 Training Session #1
Comparison
Attribute Angular JS Angular 2 React
DOM Regular DOM Regular DOM Virtual DOM
Packaging Weak Medium Strong
Abstraction Weak Medium Strong
Debugging General Good HTML / Bad JS Goos JS / Good HTML Good JS / Bad HTML
Binding 2 Way 2 Way Uni-Directional
Templating HTML TypeScript JSX
Component Model Weak Strong Medium
MVC YES YES View Layer Only
Rendering Client Side Client Side Server Side
9
3. Tools
NodeJS
http://nodejs.org
11
Angular CLI
https://cli.angular.io/
“Angular CLI is a command line interface for Angular”
12
Visual Studio Code
http://code.visualstudio.com/
“ Visual Studio Code is a source code editor developed by Microsoft for
Windows, Linux and macOS. It includes support for debugging, embedded Git
control, syntax highlighting, intelligent code completion, snippets, and code
refactoring ”
13
Angular JS2 Training Session #1
Angular JS2 Training Session #1
4. TypeScript
Introduction to Typescript
“TypeScript is a typed
superset of JavaScript.”
17
TypeScript & ECMAScript
“TypeScript is pure object oriented with classes,
interfaces and statically typed like C# or Java.”
18
Data Types - TypeScript
Data Type Keyword Description
Number number
Double precision 64-bit floating point values. It can be used
to represent both, integers and fractions.
String string Represents a sequence of Unicode characters
Boolean Boolean Represents logical values, true and false
Void void
Used on function return types to represent non-returning
functions
Null null Represents an intentional absence of an object value.
Undefined undefined Denotes value given to all uninitialised variables
19
Null & Undefined
Controversy
✓ null & undefined are not same.
✓ null => The variable has been set to an object whose
value is undefined.
✓ undefined => A variable initialised with undefined
means that the variable has no value or object
assigned to it.
20
Javascript <-> Typescript
✓ Operators => Conditional and Bitwise Operators
✓ Loops => For and While
✓ Decision Making => If else
✓ Arrays
✓ JSON object
What’s common between Javascript and TypeScript?
21
Variables - Typescript
✓ // The variable stores a value of type string

var name:string = “mary”;
✓ // The variable is a string variable. The variable’s value is set to
undefined by default

var name:string;
✓ // The variable’s type is inferred from the data type of the value. Here,
the variable is of the type string

var name = “marry”;
✓ // The variable’s data type is any. Its value is set to undefined by default.

var name;
22
Functions #1 - Typescript
✓ // Function with optional parameter

function disp_details(id:number,name:string,mail_id?:string)
{
console.log("ID:", id);
console.log("Name",name);
if(mail_id!=undefined)
console.log("Email Id",mail_id);
}


disp_details(123,"John");
disp_details(111,"mary","mary@xyz.com");
23
Functions #2 - Typescript
✓ // Function with rest parameter

function addNumbers(…nums:number[ ]) {
var i;
var sum:number = 0;
for (i = 0; i < nums.length; i++) {
sum = sum + nums[ i ];
}
console.log("sum of the numbers”, sum);
}


addNumbers(1, 2, 3);
addNumbers(10, 10, 10, 10, 10);
24
Tuples - Typescript
✓ // Defining a tuple

var myTuple = [ ];
✓ // Defining a tuple and assigning values at same time

var myTuple = [10, 20.3, “Angular JS”];
✓ // Accessing a tuple value

console.log(“Tuple at #2”, myTuple[2]);

console.log(“Tuple at #0”, myTuple[0]);

console.log(“Tuple at #1”, myTuple[1]);
“Tuples are similar to Arrays but can store multiple data type in same
variable”
25
Union - Typescript
✓ // Defining a union

var myUnion:string|number;
✓ // Assigning values to a union variable

myUnion = 10;

myUnion = “This is a string value assigned to Union
variable”;
“Union is the type of variable that can store more
than one data type.”
26
Interfaces - Typescript
✓ // Lets consider an object

var person = {
FirstName:"Tom",
LastName:"Hanks",
sayHi: ()=>{ return "Hi"} 

};
✓ To reuse the signature across objects we can define it as
an interface.
“An interface is a syntactical contract that an entity
should conform to.”
27
Interfaces Example
interface IPerson {
firstName:string,
lastName:string,
sayHi: ()=>string
}
var customer:IPerson = {
firstName:"Tom",
lastName:"Hanks",
sayHi: ():string =>{return "Hi there"}
}
console.log("Customer Object ")
console.log(customer.firstName)
console.log(customer.lastName)
console.log(customer.sayHi())
var employee:IPerson = {
firstName:"Jim",
lastName:"Blakes",
sayHi: ():string =>{return "Hello!!!"}
}
console.log("Employee Object ")
console.log(employee.firstName) console.log(employee.lastName);
28
Classes - Typescript
“A class in terms of OOP is a blueprint for creating
objects. A class encapsulates data for the object.”
class Car {
//field
engine:string;
//constructor
constructor(engine:string) {
this.engine = engine
}
//function
disp():void {
console.log("Engine is : “ + this.engine);
}
}
29
Namespaces - Typescript
“A namespace is a way to logically group related code. It
helps in resolving global namespace pollution problem
presents in Javascript.”
Example:-


namespace SomeNameSpaceName {
export interface ISomeInterfaceName { }
export class SomeClassName { }
}
“The classes or interfaces which should be accessed outside
the namespace should be marked with keyword export.”
30
Modules - Typescript
“A module is designed with the idea to organise
code written in TypeScript.”
Internal External
31
Internal Modules
“Internal modules came in earlier version of
Typescript and now replaced by namespaces.”
32
External Modules
“External modules in TypeScript exists to specify and
load dependencies between multiple external JS files.”
Example:-


import someInterfaceRef = require(“./SomeInterface”);
There are two occasions when we need to load external JS files:-
➡ Server Side - NodeJs
➡ Client Side - RequireJs
33
5. Architecture
Architecture
Components Directives
ServicesRouters
ngModule
35
6. ngModule
ngModule
• Module is a group of components in Angular JS 2.
• We can import one or more module in another module
and all associated will automatically get imported.
• We need not to worry about importing each component
individually.
“NgModules help organise an application into cohesive
blocks of functionality”
Features:
37
ngModule
• Feature as a Module
• Shared Utilities as a Module
How modules should be organised?
There are no standard way to group modules, but the
recommendations are:
https://scotch.io/bar-talk/getting-to-know-angular-2s-module-ngmodule
38
ngModule
@NgModule({
declarations: [ // put all your components / directives / pipes here
AppComponent, // the root component
No1Component, No2Component, ... // e.g. put all 10 components here
AComponent, BComponent, // e.g. put component A and B here
NiceDirective,
AwesomePipe,
],
imports: [ // put all your modules here
BrowserModule, // Angular 2 out of the box modules
TranslateModule, // some third party modules / libraries
],
providers: [ // put all your services here
AwesomeService,
],
bootstrap: [ // The main components to be bootstrapped in main.ts file,
normally one only
AppComponent
]
})
export class AppModule { }
Components
“Encapsulate the template, data and the behaviour
of view. Also known as view components”
40
Directives
“Modifies DOM elements and/or extend their
behaviour”
41
Routes
“Responsible for navigation”
42
Services
“Responsible for arranging data for view
components”
43
7. Components

(a.k.a ViewComponents)
Components
“Encapsulate the template, data and the behaviour of view. Also known as view components”
{ } Root Component
{ } { }
{ } { } { }
45
Navbar
Sidebar Content
{ } { }
{ }
Angular JS2 Training Session #1
Angular JS2 Training Session #1
Creating Component
“Component can be creating using Angular CLI tool”
Example:-


ng generate component my-new-component
ng	g	component	my-new-component	#	using	the	alias



#	components	support	relative	path	generation	
#	if	in	the	directory	src/app/feature/	and	you	run	
ng	g	component	new-cmp	
#	your	component	will	be	generated	in	src/app/feature/new-cmp	


#	but	if	you	were	to	run	
ng	g	component	../newer-cmp	
#	your	component	will	be	generated	in	src/app/newer-cmp
49
Signature for Component
50
✓ Selector Name:- Tag name that needs to be
searched in parent template
✓ Template URL:- Path of HTML template file
associated with this component
✓ Style URLs:- String Array containing path of CSS files
that are used to decorate this component.
In component we need to define following details:-
Component Example
import { Component } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'selector-demo',
templateUrl: 'demo.component.html',
styleUrls: ['demo.component.css',

'demo2.component.css']
})
export class DemoComponent { }
51
Wrapping up
✓ Introduction to Angular JS
✓ Difference b/w Angular and Angular 2 and React JS
✓ Development Tools
✓ Basics of TypeScript
✓ Angular JS Architecture
Topics Covered
Next Session
๏ Passing data and events between components
๏ Directives and Pipes
๏ Model Classes
๏ Forms and Validation
52
Angular JS2 Training Session #1
Thank You

More Related Content

PPT
Java script -23jan2015
PPTX
Java script basics
PPT
Java script
PPT
Learn javascript easy steps
PPTX
JavaScript Fundamentals & JQuery
PPTX
AngularJS
PDF
Domain Driven Design and Hexagonal Architecture with Rails
PPTX
Open Source Ajax Solution @OSDC.tw 2009
Java script -23jan2015
Java script basics
Java script
Learn javascript easy steps
JavaScript Fundamentals & JQuery
AngularJS
Domain Driven Design and Hexagonal Architecture with Rails
Open Source Ajax Solution @OSDC.tw 2009

What's hot (20)

PPT
Java script
ZIP
Fundamental JavaScript [In Control 2009]
PDF
Java script tutorial
PDF
Secrets of JavaScript Libraries
PDF
Javascript Best Practices
PDF
Seaside - Web Development As You Like It
PPTX
Java script
PPT
Java script Learn Easy
PPTX
Introduction to JavaScript Basics.
PDF
Web 6 | JavaScript DOM
PDF
Javascript
PPTX
Javascript
PPTX
Javascript
PPT
Java script final presentation
PPTX
Lab#1 - Front End Development
PPT
Javascript by geetanjali
PPTX
Java script
DOCX
Javascript tutorial
PPT
Java Script ppt
Java script
Fundamental JavaScript [In Control 2009]
Java script tutorial
Secrets of JavaScript Libraries
Javascript Best Practices
Seaside - Web Development As You Like It
Java script
Java script Learn Easy
Introduction to JavaScript Basics.
Web 6 | JavaScript DOM
Javascript
Javascript
Javascript
Java script final presentation
Lab#1 - Front End Development
Javascript by geetanjali
Java script
Javascript tutorial
Java Script ppt
Ad

Similar to Angular JS2 Training Session #1 (20)

PDF
Wt unit 2 ppts client side technology
PDF
Wt unit 2 ppts client sied technology
PPTX
JavaScripts & jQuery
PDF
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
PPT
eXo SEA - JavaScript Introduction Training
PPT
Smoothing Your Java with DSLs
PPTX
Angular js
PDF
IOC + Javascript
PDF
AngularJS Workshop
PPTX
Practical AngularJS
PDF
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
PPTX
CSC PPT 12.pptx
PPTX
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
PDF
Unit 4(it workshop)
PPT
Reversing JavaScript
PPT
The Theory Of The Dom
PDF
Angular 2 Essential Training
PDF
Android L01 - Warm Up
PPTX
JavaScript lesson 1.pptx
PDF
SproutCore and the Future of Web Apps
Wt unit 2 ppts client side technology
Wt unit 2 ppts client sied technology
JavaScripts & jQuery
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
eXo SEA - JavaScript Introduction Training
Smoothing Your Java with DSLs
Angular js
IOC + Javascript
AngularJS Workshop
Practical AngularJS
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
CSC PPT 12.pptx
unit4 wp.pptxjvlbpuvghuigv8ytg2ugvugvuygv
Unit 4(it workshop)
Reversing JavaScript
The Theory Of The Dom
Angular 2 Essential Training
Android L01 - Warm Up
JavaScript lesson 1.pptx
SproutCore and the Future of Web Apps
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
top salesforce developer skills in 2025.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Digital Strategies for Manufacturing Companies
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PTS Company Brochure 2025 (1).pdf.......
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Design an Analysis of Algorithms II-SECS-1021-03
Odoo Companies in India – Driving Business Transformation.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
CHAPTER 2 - PM Management and IT Context
Wondershare Filmora 15 Crack With Activation Key [2025
top salesforce developer skills in 2025.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
history of c programming in notes for students .pptx
Digital Strategies for Manufacturing Companies
Understanding Forklifts - TECH EHS Solution
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Transform Your Business with a Software ERP System
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

Angular JS2 Training Session #1

  • 3. Introduction “Angular is a Javascript Framework which allows you to create reactive Single-Page-Applications (SPAs)” 3
  • 4. Features Cross Platform ➡ Progressive Web Apps ➡ Native Mobile Apps ➡ Desktop Speed and Performance ➡ Code Generation ➡ Universal ➡ Code Splitting 4
  • 5. Features Productivity ➡ Templates ➡ Angular CLI ➡ IDEs Full Development Story ➡ Testing ➡ Animation ➡ Accessibility 5
  • 9. Comparison Attribute Angular JS Angular 2 React DOM Regular DOM Regular DOM Virtual DOM Packaging Weak Medium Strong Abstraction Weak Medium Strong Debugging General Good HTML / Bad JS Goos JS / Good HTML Good JS / Bad HTML Binding 2 Way 2 Way Uni-Directional Templating HTML TypeScript JSX Component Model Weak Strong Medium MVC YES YES View Layer Only Rendering Client Side Client Side Server Side 9
  • 12. Angular CLI https://cli.angular.io/ “Angular CLI is a command line interface for Angular” 12
  • 13. Visual Studio Code http://code.visualstudio.com/ “ Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring ” 13
  • 17. Introduction to Typescript “TypeScript is a typed superset of JavaScript.” 17
  • 18. TypeScript & ECMAScript “TypeScript is pure object oriented with classes, interfaces and statically typed like C# or Java.” 18
  • 19. Data Types - TypeScript Data Type Keyword Description Number number Double precision 64-bit floating point values. It can be used to represent both, integers and fractions. String string Represents a sequence of Unicode characters Boolean Boolean Represents logical values, true and false Void void Used on function return types to represent non-returning functions Null null Represents an intentional absence of an object value. Undefined undefined Denotes value given to all uninitialised variables 19
  • 20. Null & Undefined Controversy ✓ null & undefined are not same. ✓ null => The variable has been set to an object whose value is undefined. ✓ undefined => A variable initialised with undefined means that the variable has no value or object assigned to it. 20
  • 21. Javascript <-> Typescript ✓ Operators => Conditional and Bitwise Operators ✓ Loops => For and While ✓ Decision Making => If else ✓ Arrays ✓ JSON object What’s common between Javascript and TypeScript? 21
  • 22. Variables - Typescript ✓ // The variable stores a value of type string
 var name:string = “mary”; ✓ // The variable is a string variable. The variable’s value is set to undefined by default
 var name:string; ✓ // The variable’s type is inferred from the data type of the value. Here, the variable is of the type string
 var name = “marry”; ✓ // The variable’s data type is any. Its value is set to undefined by default.
 var name; 22
  • 23. Functions #1 - Typescript ✓ // Function with optional parameter
 function disp_details(id:number,name:string,mail_id?:string) { console.log("ID:", id); console.log("Name",name); if(mail_id!=undefined) console.log("Email Id",mail_id); } 
 disp_details(123,"John"); disp_details(111,"mary","mary@xyz.com"); 23
  • 24. Functions #2 - Typescript ✓ // Function with rest parameter
 function addNumbers(…nums:number[ ]) { var i; var sum:number = 0; for (i = 0; i < nums.length; i++) { sum = sum + nums[ i ]; } console.log("sum of the numbers”, sum); } 
 addNumbers(1, 2, 3); addNumbers(10, 10, 10, 10, 10); 24
  • 25. Tuples - Typescript ✓ // Defining a tuple
 var myTuple = [ ]; ✓ // Defining a tuple and assigning values at same time
 var myTuple = [10, 20.3, “Angular JS”]; ✓ // Accessing a tuple value
 console.log(“Tuple at #2”, myTuple[2]);
 console.log(“Tuple at #0”, myTuple[0]);
 console.log(“Tuple at #1”, myTuple[1]); “Tuples are similar to Arrays but can store multiple data type in same variable” 25
  • 26. Union - Typescript ✓ // Defining a union
 var myUnion:string|number; ✓ // Assigning values to a union variable
 myUnion = 10;
 myUnion = “This is a string value assigned to Union variable”; “Union is the type of variable that can store more than one data type.” 26
  • 27. Interfaces - Typescript ✓ // Lets consider an object
 var person = { FirstName:"Tom", LastName:"Hanks", sayHi: ()=>{ return "Hi"} 
 }; ✓ To reuse the signature across objects we can define it as an interface. “An interface is a syntactical contract that an entity should conform to.” 27
  • 28. Interfaces Example interface IPerson { firstName:string, lastName:string, sayHi: ()=>string } var customer:IPerson = { firstName:"Tom", lastName:"Hanks", sayHi: ():string =>{return "Hi there"} } console.log("Customer Object ") console.log(customer.firstName) console.log(customer.lastName) console.log(customer.sayHi()) var employee:IPerson = { firstName:"Jim", lastName:"Blakes", sayHi: ():string =>{return "Hello!!!"} } console.log("Employee Object ") console.log(employee.firstName) console.log(employee.lastName); 28
  • 29. Classes - Typescript “A class in terms of OOP is a blueprint for creating objects. A class encapsulates data for the object.” class Car { //field engine:string; //constructor constructor(engine:string) { this.engine = engine } //function disp():void { console.log("Engine is : “ + this.engine); } } 29
  • 30. Namespaces - Typescript “A namespace is a way to logically group related code. It helps in resolving global namespace pollution problem presents in Javascript.” Example:- 
 namespace SomeNameSpaceName { export interface ISomeInterfaceName { } export class SomeClassName { } } “The classes or interfaces which should be accessed outside the namespace should be marked with keyword export.” 30
  • 31. Modules - Typescript “A module is designed with the idea to organise code written in TypeScript.” Internal External 31
  • 32. Internal Modules “Internal modules came in earlier version of Typescript and now replaced by namespaces.” 32
  • 33. External Modules “External modules in TypeScript exists to specify and load dependencies between multiple external JS files.” Example:- 
 import someInterfaceRef = require(“./SomeInterface”); There are two occasions when we need to load external JS files:- ➡ Server Side - NodeJs ➡ Client Side - RequireJs 33
  • 37. ngModule • Module is a group of components in Angular JS 2. • We can import one or more module in another module and all associated will automatically get imported. • We need not to worry about importing each component individually. “NgModules help organise an application into cohesive blocks of functionality” Features: 37
  • 38. ngModule • Feature as a Module • Shared Utilities as a Module How modules should be organised? There are no standard way to group modules, but the recommendations are: https://scotch.io/bar-talk/getting-to-know-angular-2s-module-ngmodule 38
  • 39. ngModule @NgModule({ declarations: [ // put all your components / directives / pipes here AppComponent, // the root component No1Component, No2Component, ... // e.g. put all 10 components here AComponent, BComponent, // e.g. put component A and B here NiceDirective, AwesomePipe, ], imports: [ // put all your modules here BrowserModule, // Angular 2 out of the box modules TranslateModule, // some third party modules / libraries ], providers: [ // put all your services here AwesomeService, ], bootstrap: [ // The main components to be bootstrapped in main.ts file, normally one only AppComponent ] }) export class AppModule { }
  • 40. Components “Encapsulate the template, data and the behaviour of view. Also known as view components” 40
  • 41. Directives “Modifies DOM elements and/or extend their behaviour” 41
  • 43. Services “Responsible for arranging data for view components” 43
  • 45. Components “Encapsulate the template, data and the behaviour of view. Also known as view components” { } Root Component { } { } { } { } { } 45
  • 49. Creating Component “Component can be creating using Angular CLI tool” Example:- 
 ng generate component my-new-component ng g component my-new-component # using the alias
 
 # components support relative path generation # if in the directory src/app/feature/ and you run ng g component new-cmp # your component will be generated in src/app/feature/new-cmp 
 # but if you were to run ng g component ../newer-cmp # your component will be generated in src/app/newer-cmp 49
  • 50. Signature for Component 50 ✓ Selector Name:- Tag name that needs to be searched in parent template ✓ Template URL:- Path of HTML template file associated with this component ✓ Style URLs:- String Array containing path of CSS files that are used to decorate this component. In component we need to define following details:-
  • 51. Component Example import { Component } from '@angular/core'; @Component({ moduleId: module.id, selector: 'selector-demo', templateUrl: 'demo.component.html', styleUrls: ['demo.component.css',
 'demo2.component.css'] }) export class DemoComponent { } 51
  • 52. Wrapping up ✓ Introduction to Angular JS ✓ Difference b/w Angular and Angular 2 and React JS ✓ Development Tools ✓ Basics of TypeScript ✓ Angular JS Architecture Topics Covered Next Session ๏ Passing data and events between components ๏ Directives and Pipes ๏ Model Classes ๏ Forms and Validation 52