SlideShare a Scribd company logo
1
Angular2 with TypeScript
- Ravi Mone
About me
● I AM Ravi Mone
● Have ample year of experience in back-end and Front-end.
● Working on technologies like Symfony2, AngularJS, ReactJS.
● Currently serving in Techjini Solution as Team Leader.
● You can connect me via
○ https://in.linkedin.com/in/ravi-mone-49b26519
Agenda
• What is TypeScript?
• Why use TypeScript?
• Angular2 Framework Architecture
• What’s happening in Angular2?
• Building Blocks of Angular2
• Life Cycle Hooks
• Bootstrap the application
• Routing
• Demo
What is TypeScript?
TypeScript (contd.)
Why use TypeScript? (Contd.)
• TypeScript follows a less radical/progressive approach.
• It’s a typed superset of JavaScript and existing JavaScript projects can be
converted to TypeScript simply by renaming the source files from*.js to *.ts
Angular2 Framework Architecture
What’s happening in Angular2?
• Angular2 is not yet stable. The features and guidelines are subject to
change from time to time.
• Current RC (Release Candidate) version
https://github.com/angular/angular/milestones
• To be aware of the weekly updates/modifications, visit: https://github.
com/angular/angular/blob/master/CHANGELOG.md
• To know about the Angular2 Style Guide (Alpha-Version), visit:
https://github.com/mgechev/angular2-style-guide
8 Main building blocks of an Angular2 App
1. Module
2. Component
3. Template
4. Meta Data
5. Data-Binding
6. Services
7. Directives
8. Dependency Injection
Module (Export/Import)
• In ES6 each module is defined in its own file.
• The functions or variables defined in a module are not visible outside
unless you explicitly export them. This means that you can write code in
your module and only export those values which should be accessed by
other parts of your app.
• ES6 modules are declarative in nature. To export certain variables from a
module you just use the keyword export.
• Similarly, to consume the exported variables in a different module you use
import.
Let’s create a simple module with two utility functions:
generateRandom() : Generates a random number.
sum() : Adds two numbers.
Next, let’s create a file named utility.js for the module:
And in your app.js
2. Component (@Component({ … }) )
• In Angular 2, Components are the main way we build and specify elements
and logic on the page.
• Create reusable UI building blocks for an application.
1. Each Angular component requires a single @Component. The @Component annotation
specifies when a component is instantiated, and which properties and hostListeners it
binds to.
2. When a component is instantiated, it acts according to the encapsulation value
ViewEncapsulation.native,
ViewEncapsulation.Emulated,
ViewEncapsulation.None.
3. All template expressions and statements are then evaluated against the component
instance.
3. Template
• We define a Component's view with its companion template.
• A template is a form of HTML that tells Angular how to render the
Component.
• A template looks like regular HTML, with data/event binding properties
Sample Angular Template
4. @ Meta Data
• Metadata is data that describes other data.
• Meta is a prefix that in most information technology usages means "an
underlying definition or description."
• Metadata summarizes basic information about data, which can make
finding and working with particular instances of data easier.
So far Meta Data Classes
5. {{ DATA BINDING}}
Data Binding (contd.)
1. The "interpolation" displays the component's hero.name property value
within the <div> tags.
2. The [hero] property binding passes the selectedHero from the parent
HeroListComponent to the hero property of the childHeroDetailComponent.
Data Binding (contd.)
3. The (click) event binding calls the Component's selectHero method when the
user clicks on a hero's name.
4. Two-way data binding is an important fourth form that combines property and
event binding in a single notation using the ngModeldirective
6. Service
• If a piece of code is needed by many components in our application then
create a single reusable service.
• When a component needs this service we can simply inject it (the service)
using DI (@Injectable).
• A service is the mechanism used to share functionalities over Components
(or with one Component if our app contains only one Component).
• Service is the best place from where we can bring our external Data to our
app. Or do some repetitive task or calculations.
• Service can be shared between as many as Components we want.
7. @Directive
● A directive is simply a class with a specific Metadata (@Directive
decorator)
● We have three kinds of directives:
○ Components: yes a component is a directive. (@Component)
○ Structural directives: conditionally add or remove content from the
DOM.
○ Attribute directives: Alters the Element by changing its behavior or the
appearance
Three Kinds of Directives
1. Component
<angular-2-hello-world>loading…</angular-2-hello-world>
2. Structural Directive (ngIf, ngFor )
<div*myAngular2Directive=”ShowMeIfFalse”>
<b>I’m visible => showMeIfFalse=false </b>
</div>
3. Attribute Directive
<p [zoomIn]=”blue”> Some thing goes here </p>
Directive Vs. Component
8. Dependency Injection (Provider, BootStrap(‘’, []))
• In software engineering, dependency injection is a software design pattern
that implements inversion of control for resolving dependencies.
• The idea behind dependency injection is very simple. If you have a
component that depends on a service. You do not create that service
yourself. Instead, you request one in the constructor, and the framework
will provide you one. By doing so you can depend on interfaces rather than
concrete types. This leads to more decoupled code, which enables
testability, and other great things
Demo: http://plnkr.co/edit/CG9HuLzI6KqncxiVeACM?p=preview
Life Cycle Hooks
• When the component class implements some lifecycle_hooks the
callbacks are called by the change detection at defined points in time
during the life of the component.
Demo: http://plnkr.co/edit/IVn4bb4Fp2eDDPrLODay?p=preview
Bootstrap the App
● You instantiate an Angular application by explicitly specifying a component
to use as the root component for your application via:
○ bootstrap(‘<root component>’) in case there is a single component
○ bootstrap(‘<root component>’, [<DI>]) in case the component has
dependencies.
Routing
Demo Links
• Kick Start: Demo a small component (meet-up folder)
• Forms: http://plnkr.co/edit/aN3LhpwnH2qyRYNfJn8q?p=preview
• Inputs: http://plnkr.co/edit/rV5s4CKZWLfhW63gGnKp?p=preview
• Outputs: http://plnkr.co/edit/7ByGLXviLy4SbrXgdlx7?p=preview
• ViewChild: http://plnkr.co/edit/vhdL7e0SccIbMk0eZKfh?p=preview
• Encapsulation : https://plnkr.co/edit/inF7VaYJvj8uJfuLKV4Z?p=preview
• Directives : http://plnkr.co/edit/P0G8cWYCP8sC7Yrvlo8L?p=preview
• CRUD application : https://github.com/ravi-mone/angular2-crud
• Routes : https://github.com/ravi-mone/angular2-lab
Angular2 with type script
Angular2 with type script

More Related Content

What's hot

Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Knoldus Inc.
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core concepts
Codemotion
 
Angular 2 Crash Course
Angular  2 Crash CourseAngular  2 Crash Course
Angular 2 Crash Course
Elisha Kramer
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2
Dragos Ionita
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Naveen Pete
 
Angular 2
Angular 2Angular 2
Angular 2
Nigam Goyal
 
Building Universal Applications with Angular 2
Building Universal Applications with Angular 2Building Universal Applications with Angular 2
Building Universal Applications with Angular 2
Minko Gechev
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Dawid Myslak
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
Nicolas PENNEC
 
Angular 2
Angular 2Angular 2
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
Shawn McKay
 
What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
Ran Wahle
 
Building scalable modular app with Angular2 concept
Building scalable modular app with Angular2 conceptBuilding scalable modular app with Angular2 concept
Building scalable modular app with Angular2 concept
kzw
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
Dor Moshe
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new framework
Codemotion
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
Commit University
 
Migrating an application from Angular 1 to Angular 2
Migrating an application from Angular 1 to Angular 2 Migrating an application from Angular 1 to Angular 2
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
Angular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code levelAngular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code level
Anuradha Bandara
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
Dhyego Fernando
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
Oswald Campesato
 

What's hot (20)

Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular 2: core concepts
Angular 2: core conceptsAngular 2: core concepts
Angular 2: core concepts
 
Angular 2 Crash Course
Angular  2 Crash CourseAngular  2 Crash Course
Angular 2 Crash Course
 
Adventures with Angular 2
Adventures with Angular 2Adventures with Angular 2
Adventures with Angular 2
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular 2
Angular 2Angular 2
Angular 2
 
Building Universal Applications with Angular 2
Building Universal Applications with Angular 2Building Universal Applications with Angular 2
Building Universal Applications with Angular 2
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
 
Angular 2
Angular 2Angular 2
Angular 2
 
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
 
What’s new in angular 2
What’s new in angular 2What’s new in angular 2
What’s new in angular 2
 
Building scalable modular app with Angular2 concept
Building scalable modular app with Angular2 conceptBuilding scalable modular app with Angular2 concept
Building scalable modular app with Angular2 concept
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new framework
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
 
Migrating an application from Angular 1 to Angular 2
Migrating an application from Angular 1 to Angular 2 Migrating an application from Angular 1 to Angular 2
Migrating an application from Angular 1 to Angular 2
 
Angular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code levelAngular 1.x vs 2 - In code level
Angular 1.x vs 2 - In code level
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 

Viewers also liked

Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
Nir Kaufman
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
Nir Kaufman
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
Johannes Rudolph
 
Launch Yourself into The AngularJS 2 And TypeScript Space
Launch Yourself into The AngularJS 2 And TypeScript SpaceLaunch Yourself into The AngularJS 2 And TypeScript Space
Launch Yourself into The AngularJS 2 And TypeScript Space
ColdFusionConference
 
Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016
Luciano Murruni
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
Filip Bruun Bech-Larsen
 
Angular 2 MVD workshop
Angular 2 MVD workshopAngular 2 MVD workshop
Angular 2 MVD workshop
Iran Reyes Fleitas
 
Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3
Bruce Pentreath
 
React JS
React JSReact JS
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
Sebastian Pożoga
 
Angular 2.0 change detection
Angular 2.0 change detectionAngular 2.0 change detection
Angular 2.0 change detection
Ran Wahle
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
Yakov Fain
 
AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.
Dragos Mihai Rusu
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
Nerd Tzanetopoulos
 
How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!
Nir Kaufman
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
Ran Wahle
 
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Codemotion
 
Introduction angular2 français
Introduction angular2 françaisIntroduction angular2 français
Introduction angular2 français
Saameh BEN SAID
 
Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016
Matt Raible
 

Viewers also liked (20)

Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
Angular2 - getting-ready
Angular2 - getting-ready Angular2 - getting-ready
Angular2 - getting-ready
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
 
Launch Yourself into The AngularJS 2 And TypeScript Space
Launch Yourself into The AngularJS 2 And TypeScript SpaceLaunch Yourself into The AngularJS 2 And TypeScript Space
Launch Yourself into The AngularJS 2 And TypeScript Space
 
Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
Angular 2 MVD workshop
Angular 2 MVD workshopAngular 2 MVD workshop
Angular 2 MVD workshop
 
Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3
 
React JS
React JSReact JS
React JS
 
Angular2 - In Action
Angular2  - In ActionAngular2  - In Action
Angular2 - In Action
 
Angular 2.0 change detection
Angular 2.0 change detectionAngular 2.0 change detection
Angular 2.0 change detection
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.AngularJS - Overcoming performance issues. Limits.
AngularJS - Overcoming performance issues. Limits.
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!How Angular2 Can Improve Your AngularJS Apps Today!
How Angular2 Can Improve Your AngularJS Apps Today!
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
Progressive Web Apps: trick or real magic? - Maurizio Mangione - Codemotion M...
 
Introduction angular2 français
Introduction angular2 françaisIntroduction angular2 français
Introduction angular2 français
 
Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016
 

Similar to Angular2 with type script

Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
Goa App
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Angular IO
Angular IOAngular IO
Angular IO
Jennifer Estrada
 
Ng talk
Ng talkNg talk
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
Knoldus Inc.
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
AshokKumar616995
 
Migrating an Application from Angular 1 to Angular 2
Migrating an Application from Angular 1 to Angular 2 Migrating an Application from Angular 1 to Angular 2
Migrating an Application from Angular 1 to Angular 2
Ross Dederer
 
Angular2
Angular2Angular2
Angular2
kunalkumar376
 
AngularJs
AngularJsAngularJs
AngularJs
Abdhesh Kumar
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
Arunangsu Sahu
 
Angular js
Angular jsAngular js
Angular js
Knoldus Inc.
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
WebStackAcademy
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Angular.ppt
Angular.pptAngular.ppt
Angular.ppt
Mytrux1
 
17612235.ppt
17612235.ppt17612235.ppt
17612235.ppt
yovixi5669
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
valuebound
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
Rolands Krumbergs
 
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
Ansley Rodrigues
 

Similar to Angular2 with type script (20)

Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Angular IO
Angular IOAngular IO
Angular IO
 
Ng talk
Ng talkNg talk
Ng talk
 
Building blocks of Angular
Building blocks of AngularBuilding blocks of Angular
Building blocks of Angular
 
Angular Basics.pptx
Angular Basics.pptxAngular Basics.pptx
Angular Basics.pptx
 
Migrating an Application from Angular 1 to Angular 2
Migrating an Application from Angular 1 to Angular 2 Migrating an Application from Angular 1 to Angular 2
Migrating an Application from Angular 1 to Angular 2
 
Angular2
Angular2Angular2
Angular2
 
AngularJs
AngularJsAngularJs
AngularJs
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
 
Angular js
Angular jsAngular js
Angular js
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Angular.ppt
Angular.pptAngular.ppt
Angular.ppt
 
17612235.ppt
17612235.ppt17612235.ppt
17612235.ppt
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
 
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
 

Recently uploaded

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 

Recently uploaded (20)

Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 

Angular2 with type script

  • 2. About me ● I AM Ravi Mone ● Have ample year of experience in back-end and Front-end. ● Working on technologies like Symfony2, AngularJS, ReactJS. ● Currently serving in Techjini Solution as Team Leader. ● You can connect me via ○ https://in.linkedin.com/in/ravi-mone-49b26519
  • 3. Agenda • What is TypeScript? • Why use TypeScript? • Angular2 Framework Architecture • What’s happening in Angular2? • Building Blocks of Angular2 • Life Cycle Hooks • Bootstrap the application • Routing • Demo
  • 6.
  • 7. Why use TypeScript? (Contd.) • TypeScript follows a less radical/progressive approach. • It’s a typed superset of JavaScript and existing JavaScript projects can be converted to TypeScript simply by renaming the source files from*.js to *.ts
  • 9. What’s happening in Angular2? • Angular2 is not yet stable. The features and guidelines are subject to change from time to time. • Current RC (Release Candidate) version https://github.com/angular/angular/milestones • To be aware of the weekly updates/modifications, visit: https://github. com/angular/angular/blob/master/CHANGELOG.md • To know about the Angular2 Style Guide (Alpha-Version), visit: https://github.com/mgechev/angular2-style-guide
  • 10. 8 Main building blocks of an Angular2 App 1. Module 2. Component 3. Template 4. Meta Data 5. Data-Binding 6. Services 7. Directives 8. Dependency Injection
  • 11. Module (Export/Import) • In ES6 each module is defined in its own file. • The functions or variables defined in a module are not visible outside unless you explicitly export them. This means that you can write code in your module and only export those values which should be accessed by other parts of your app. • ES6 modules are declarative in nature. To export certain variables from a module you just use the keyword export. • Similarly, to consume the exported variables in a different module you use import.
  • 12. Let’s create a simple module with two utility functions: generateRandom() : Generates a random number. sum() : Adds two numbers. Next, let’s create a file named utility.js for the module:
  • 13. And in your app.js
  • 14. 2. Component (@Component({ … }) ) • In Angular 2, Components are the main way we build and specify elements and logic on the page. • Create reusable UI building blocks for an application. 1. Each Angular component requires a single @Component. The @Component annotation specifies when a component is instantiated, and which properties and hostListeners it binds to. 2. When a component is instantiated, it acts according to the encapsulation value ViewEncapsulation.native, ViewEncapsulation.Emulated, ViewEncapsulation.None. 3. All template expressions and statements are then evaluated against the component instance.
  • 15. 3. Template • We define a Component's view with its companion template. • A template is a form of HTML that tells Angular how to render the Component. • A template looks like regular HTML, with data/event binding properties
  • 16.
  • 18. 4. @ Meta Data • Metadata is data that describes other data. • Meta is a prefix that in most information technology usages means "an underlying definition or description." • Metadata summarizes basic information about data, which can make finding and working with particular instances of data easier.
  • 19. So far Meta Data Classes
  • 20. 5. {{ DATA BINDING}}
  • 21. Data Binding (contd.) 1. The "interpolation" displays the component's hero.name property value within the <div> tags. 2. The [hero] property binding passes the selectedHero from the parent HeroListComponent to the hero property of the childHeroDetailComponent.
  • 22. Data Binding (contd.) 3. The (click) event binding calls the Component's selectHero method when the user clicks on a hero's name. 4. Two-way data binding is an important fourth form that combines property and event binding in a single notation using the ngModeldirective
  • 23.
  • 24. 6. Service • If a piece of code is needed by many components in our application then create a single reusable service. • When a component needs this service we can simply inject it (the service) using DI (@Injectable). • A service is the mechanism used to share functionalities over Components (or with one Component if our app contains only one Component). • Service is the best place from where we can bring our external Data to our app. Or do some repetitive task or calculations. • Service can be shared between as many as Components we want.
  • 25. 7. @Directive ● A directive is simply a class with a specific Metadata (@Directive decorator) ● We have three kinds of directives: ○ Components: yes a component is a directive. (@Component) ○ Structural directives: conditionally add or remove content from the DOM. ○ Attribute directives: Alters the Element by changing its behavior or the appearance
  • 26. Three Kinds of Directives 1. Component <angular-2-hello-world>loading…</angular-2-hello-world> 2. Structural Directive (ngIf, ngFor ) <div*myAngular2Directive=”ShowMeIfFalse”> <b>I’m visible => showMeIfFalse=false </b> </div> 3. Attribute Directive <p [zoomIn]=”blue”> Some thing goes here </p>
  • 28. 8. Dependency Injection (Provider, BootStrap(‘’, [])) • In software engineering, dependency injection is a software design pattern that implements inversion of control for resolving dependencies. • The idea behind dependency injection is very simple. If you have a component that depends on a service. You do not create that service yourself. Instead, you request one in the constructor, and the framework will provide you one. By doing so you can depend on interfaces rather than concrete types. This leads to more decoupled code, which enables testability, and other great things Demo: http://plnkr.co/edit/CG9HuLzI6KqncxiVeACM?p=preview
  • 29. Life Cycle Hooks • When the component class implements some lifecycle_hooks the callbacks are called by the change detection at defined points in time during the life of the component. Demo: http://plnkr.co/edit/IVn4bb4Fp2eDDPrLODay?p=preview
  • 30. Bootstrap the App ● You instantiate an Angular application by explicitly specifying a component to use as the root component for your application via: ○ bootstrap(‘<root component>’) in case there is a single component ○ bootstrap(‘<root component>’, [<DI>]) in case the component has dependencies.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. Demo Links • Kick Start: Demo a small component (meet-up folder) • Forms: http://plnkr.co/edit/aN3LhpwnH2qyRYNfJn8q?p=preview • Inputs: http://plnkr.co/edit/rV5s4CKZWLfhW63gGnKp?p=preview • Outputs: http://plnkr.co/edit/7ByGLXviLy4SbrXgdlx7?p=preview • ViewChild: http://plnkr.co/edit/vhdL7e0SccIbMk0eZKfh?p=preview • Encapsulation : https://plnkr.co/edit/inF7VaYJvj8uJfuLKV4Z?p=preview • Directives : http://plnkr.co/edit/P0G8cWYCP8sC7Yrvlo8L?p=preview • CRUD application : https://github.com/ravi-mone/angular2-crud • Routes : https://github.com/ravi-mone/angular2-lab