SlideShare a Scribd company logo
1 of 25
“Angular Js 2”
Cubet Seminar
Presented by “Bilex Anto”
“We help build and architect IT solutions”
About Cubet
Founded in 2007, Cubet Techno Labs
is an end-to-end SMAC (social,
mobile, analytics and cloud) consulting
company with offices at Kochi, India
and London, UK. With expertise in
insightful product strategy, well-crafted
design and proficient development for
high-end web and mobile application
technologies.
Where we stand
Visit – www.cubettech.com
Indroduction
Visit – www.cubettech.com
 AngularJS is a structural framework for dynamic web apps
 AngularJS extends HTML attributes with Directives, and binds data
to HTML with Expressions.
 Release-2009
 Angular 1.5 bete latest version
 On 18th of September 2014 was pushed the initial commit of
version 2.0 of the AngularJS framework
Angular js 1 code
Visit – www.cubettech.com
angular.module(‘example’)
.controller(‘ExampleCtrl’, function($scope) {
$scope.name = “John Smith”;
});
<div ng-app=”example'>
<div ng-controller=”ExampleCtrl”>{{name}}</div>
</div>
Languages
Visit – www.cubettech.com
TypeScript
Visit – www.cubettech.com
 TypeScript is a free and open source programming
language developed and maintained by Microsoft.
 It is a strict superset of JavaScript
Module loader
Visit – www.cubettech.com
 Angular 2 uses the standard System.js (Module loader)
<script>
//bootstrap the Angular2 application
System.import('app').catch(console.log.bind(console));
</script>
In now inside our main file,
import {bootstrap} from 'angular2/angular2';
import {App} from 'app';
bootstrap(App);
Component-based UI
Visit – www.cubettech.com
Angular 1.x
angular.module(‘example’)
.controller(‘ExampleCtrl’, function() {
});
Visit – www.cubettech.com
Angular 2
import {Component, View} from 'angular2/angular2';
@Component({selector: 'example'})
@View({ templateUrl:
'./components/example/example.html'})
export class Example {}
Visit – www.cubettech.com
Angular 2 we have two types of directives.
 Directives
 Components
component is a directive that has a template and that
is what we use to represent a page in Angular 2. A
component is simply a class:
class MyComponent {
}
Visit – www.cubettech.com
In Angular 2 we have annotations. Annotations are a
way to add metadata to a class. So there is an
annotation called Component which we can use to say
that a particular class is a Component:
@Component({
selector: 'my-component'
})
class MyComponent {
}
<div id="content">
<my-component></my-component>
</div>
Goodbye $scope
Visit – www.cubettech.com
Scope is an object that refers to the application
mode.
 Instead of binding to properties in the scope
inside our templates, we directly bind to
properties of our "components".
Visit – www.cubettech.com
@Component({
selector: 'my-component'
})
@View({
template: `<div>Hello,
{{message}}</div>`
})
class MyComponent {
message: string;
constructor() {
this.message = 'World';
}
}
Dependency Injection
Visit – www.cubettech.com
Dependency Injection (DI) is a software design pattern that deals
with how components get hold of their dependencies.
Angular1
var myModule = angular.module("myModule", []);
myModule.value("numberValue", 999);
myModule.controller("MyController", function($scope, numberValue) {
console.log(numberValue);
});
Visit – www.cubettech.com
Angular 2
Directive
Visit – www.cubettech.com
Markers on a DOM element (such as an attribute, element name,
comment or CSS class)
Angular 1
<div ng-controller="Controller">
<div my-customer></div>
</div>
angular.directive('myCustomer', function() {
return {
template: 'Name: {{customer.name}} Address:
{{customer.address}}'
};
});
Visit – www.cubettech.com
Problems directive definition objects(DDO)
transclusion: What does that word even mean?
controller vs link: When to use link and when to use a controller?
compile: What should I do in there?
scope: scope: false, scope: true, scope: {}. Which one to use and why?
Visit – www.cubettech.com
Angular 2
@Directive({
selector: '[tooltip]'
})
class Tooltip {
}
<div tooltip="foo">...</div>
foo: that will restrict for an element.
[foo]: that will restrict for an attribute.
.class: that will restrict for a class.
input[type=text]: that will apply this directive only in <input
type="text">
Properties
Visit – www.cubettech.com
Old version:
<input type="text" value="foo">
The browser will parse the input element and create a node object. Then it
will start parsing each attribute to create a property inside that object. So we
will end with a node object for the input with the type and value as
properties (among others).
New version:
<img [src]="myImage">
<div [hidden]="isHidden">This div will be hidden if isHidden is true</div>
Events
Visit – www.cubettech.com
Angular 1.x:
<my-directive select="user.name(name)"></my-directive>
Angular 2 introduces a new syntax for this events, also called statements:
<my-directive (select)="user.name(name)"></my-directive>
References
Visit – www.cubettech.com
<p (click)="user.focus()">
Grab focus
</p>
<input type="text" #user [(ng-
model)]="name">
{{name}}
<input type="text" #user>
Here user reference
{{user.value}} - get value
{{user.type}} - get type
Conclusion
Visit – www.cubettech.com
Angular 2 is the right step forward. It is way simpler than Angular 1. No more
controllers, no more scope inheritance that drives us insane, the directives
API is much easier to understand than the actual DDO. No more $apply, and
the best of all things, thanks to [properties] and (events) we removed like 30
directives that are not needed anymore and apart from that, we simplified
the way of consuming directives.
Our Technologies Stack:
Server Side Application JavaScript Frameworks
Mobile App Development
Database System and Cloud
Visit – www.cubettech.com
THANKS!
ANY QUESTIONS? PLEASE GET IN TOUCH!
www.cubettech.com
Email : info@cubettech.com
Skype : cubet.se
Phone: +91 484 405 4324
Contact us:
Kemp House
160 City Road
London- EC1V2NX,
UK.info@cubettech.com
+44 2071938618
Carnival Info Park,
Unit IX-C, 9th floor PhaseIV,
Kochi, Kerala, India
info@cubettech.com
+91 484 4054324

More Related Content

What's hot

AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
Brajesh Yadav
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
David Xi Peng Yang
 

What's hot (20)

Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Angular js
Angular jsAngular js
Angular js
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
 
Angular JS, steal the idea
Angular JS, steal the ideaAngular JS, steal the idea
Angular JS, steal the idea
 
Angular js 1.3 basic tutorial
Angular js 1.3 basic tutorialAngular js 1.3 basic tutorial
Angular js 1.3 basic tutorial
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Angular directives
Angular directivesAngular directives
Angular directives
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Angular JS tutorial
Angular JS tutorialAngular JS tutorial
Angular JS tutorial
 
AngularJS
AngularJSAngularJS
AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
 
AngularJS
AngularJSAngularJS
AngularJS
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
 
Angular js
Angular jsAngular js
Angular js
 
Angular js
Angular jsAngular js
Angular js
 
Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...
Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...
Visual Studio 2010 Ultimate Architecture Experience : Toronto Code Camp 2010 ...
 

Similar to Angularjs 2

KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from Scratch
Udaya Kumar
 
Animation And Testing In AngularJS
Animation And Testing In AngularJSAnimation And Testing In AngularJS
Animation And Testing In AngularJS
Edureka!
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
sapientindia
 

Similar to Angularjs 2 (20)

Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
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
 
Angular js
Angular jsAngular js
Angular js
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Angular - Beginner
Angular - BeginnerAngular - Beginner
Angular - Beginner
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteMVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
 
KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from Scratch
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
Animation And Testing In AngularJS
Animation And Testing In AngularJSAnimation And Testing In AngularJS
Animation And Testing In AngularJS
 
Angular js workshop
Angular js workshopAngular js workshop
Angular js workshop
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJS
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Angularjs Basics
Angularjs BasicsAngularjs Basics
Angularjs Basics
 
Angular%201%20to%20angular%202
Angular%201%20to%20angular%202Angular%201%20to%20angular%202
Angular%201%20to%20angular%202
 
Angular - Chapter 3 - Components
Angular - Chapter 3 - ComponentsAngular - Chapter 3 - Components
Angular - Chapter 3 - Components
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
 
Angular js
Angular jsAngular js
Angular js
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
GDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and WorkshopGDG Atlanta - Angular.js Demo and Workshop
GDG Atlanta - Angular.js Demo and Workshop
 

More from Cubet Techno Labs

More from Cubet Techno Labs (6)

Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
 
Drupal_cubet seminar
Drupal_cubet seminarDrupal_cubet seminar
Drupal_cubet seminar
 
Let's start with REDUX
Let's start with REDUXLet's start with REDUX
Let's start with REDUX
 
JMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar pptJMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar ppt
 
Fabricjs ppt
Fabricjs pptFabricjs ppt
Fabricjs ppt
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 

Recently uploaded

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Angularjs 2

  • 1. “Angular Js 2” Cubet Seminar Presented by “Bilex Anto” “We help build and architect IT solutions”
  • 2. About Cubet Founded in 2007, Cubet Techno Labs is an end-to-end SMAC (social, mobile, analytics and cloud) consulting company with offices at Kochi, India and London, UK. With expertise in insightful product strategy, well-crafted design and proficient development for high-end web and mobile application technologies. Where we stand Visit – www.cubettech.com
  • 3. Indroduction Visit – www.cubettech.com  AngularJS is a structural framework for dynamic web apps  AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions.  Release-2009  Angular 1.5 bete latest version  On 18th of September 2014 was pushed the initial commit of version 2.0 of the AngularJS framework
  • 4. Angular js 1 code Visit – www.cubettech.com angular.module(‘example’) .controller(‘ExampleCtrl’, function($scope) { $scope.name = “John Smith”; }); <div ng-app=”example'> <div ng-controller=”ExampleCtrl”>{{name}}</div> </div>
  • 6. TypeScript Visit – www.cubettech.com  TypeScript is a free and open source programming language developed and maintained by Microsoft.  It is a strict superset of JavaScript
  • 7. Module loader Visit – www.cubettech.com  Angular 2 uses the standard System.js (Module loader) <script> //bootstrap the Angular2 application System.import('app').catch(console.log.bind(console)); </script> In now inside our main file, import {bootstrap} from 'angular2/angular2'; import {App} from 'app'; bootstrap(App);
  • 8. Component-based UI Visit – www.cubettech.com Angular 1.x angular.module(‘example’) .controller(‘ExampleCtrl’, function() { });
  • 9. Visit – www.cubettech.com Angular 2 import {Component, View} from 'angular2/angular2'; @Component({selector: 'example'}) @View({ templateUrl: './components/example/example.html'}) export class Example {}
  • 10. Visit – www.cubettech.com Angular 2 we have two types of directives.  Directives  Components component is a directive that has a template and that is what we use to represent a page in Angular 2. A component is simply a class: class MyComponent { }
  • 11. Visit – www.cubettech.com In Angular 2 we have annotations. Annotations are a way to add metadata to a class. So there is an annotation called Component which we can use to say that a particular class is a Component: @Component({ selector: 'my-component' }) class MyComponent { } <div id="content"> <my-component></my-component> </div>
  • 12. Goodbye $scope Visit – www.cubettech.com Scope is an object that refers to the application mode.  Instead of binding to properties in the scope inside our templates, we directly bind to properties of our "components".
  • 13. Visit – www.cubettech.com @Component({ selector: 'my-component' }) @View({ template: `<div>Hello, {{message}}</div>` }) class MyComponent { message: string; constructor() { this.message = 'World'; } }
  • 14. Dependency Injection Visit – www.cubettech.com Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies. Angular1 var myModule = angular.module("myModule", []); myModule.value("numberValue", 999); myModule.controller("MyController", function($scope, numberValue) { console.log(numberValue); });
  • 16. Directive Visit – www.cubettech.com Markers on a DOM element (such as an attribute, element name, comment or CSS class) Angular 1 <div ng-controller="Controller"> <div my-customer></div> </div> angular.directive('myCustomer', function() { return { template: 'Name: {{customer.name}} Address: {{customer.address}}' }; });
  • 17. Visit – www.cubettech.com Problems directive definition objects(DDO) transclusion: What does that word even mean? controller vs link: When to use link and when to use a controller? compile: What should I do in there? scope: scope: false, scope: true, scope: {}. Which one to use and why?
  • 18. Visit – www.cubettech.com Angular 2 @Directive({ selector: '[tooltip]' }) class Tooltip { } <div tooltip="foo">...</div> foo: that will restrict for an element. [foo]: that will restrict for an attribute. .class: that will restrict for a class. input[type=text]: that will apply this directive only in <input type="text">
  • 19. Properties Visit – www.cubettech.com Old version: <input type="text" value="foo"> The browser will parse the input element and create a node object. Then it will start parsing each attribute to create a property inside that object. So we will end with a node object for the input with the type and value as properties (among others). New version: <img [src]="myImage"> <div [hidden]="isHidden">This div will be hidden if isHidden is true</div>
  • 20. Events Visit – www.cubettech.com Angular 1.x: <my-directive select="user.name(name)"></my-directive> Angular 2 introduces a new syntax for this events, also called statements: <my-directive (select)="user.name(name)"></my-directive>
  • 21. References Visit – www.cubettech.com <p (click)="user.focus()"> Grab focus </p> <input type="text" #user [(ng- model)]="name"> {{name}} <input type="text" #user> Here user reference {{user.value}} - get value {{user.type}} - get type
  • 22. Conclusion Visit – www.cubettech.com Angular 2 is the right step forward. It is way simpler than Angular 1. No more controllers, no more scope inheritance that drives us insane, the directives API is much easier to understand than the actual DDO. No more $apply, and the best of all things, thanks to [properties] and (events) we removed like 30 directives that are not needed anymore and apart from that, we simplified the way of consuming directives.
  • 23. Our Technologies Stack: Server Side Application JavaScript Frameworks Mobile App Development Database System and Cloud Visit – www.cubettech.com
  • 24. THANKS! ANY QUESTIONS? PLEASE GET IN TOUCH! www.cubettech.com Email : info@cubettech.com Skype : cubet.se Phone: +91 484 405 4324
  • 25. Contact us: Kemp House 160 City Road London- EC1V2NX, UK.info@cubettech.com +44 2071938618 Carnival Info Park, Unit IX-C, 9th floor PhaseIV, Kochi, Kerala, India info@cubettech.com +91 484 4054324