SlideShare ist ein Scribd-Unternehmen logo
1 von 25
AngularJS
A radically different way of
building Single Page Apps
by Jivko Petiov
Agenda
• Demo - Hello World
• What is Angular

• Demo - How a real-world app is made
• Conclusion – why and when to use it
Demo - Hello World
What is Angular
• What is a SPA (Gmail, Github, Hotmail, Trello, Facebook)
• JavaScript Framework for building SPA apps
• “Angular is what HTML should have been, if it has been
specifically designed for AJAX apps”
JavaScript Frameworks
•
•
•
•
•
•
•
•
•

Backbone.js
Ember.js
KnockoutJS
AngularJS
Dojo
YUI
Agility.js
Knockback.js
CanJS

•
•
•
•
•
•
•
•
•

SproutCore
Polymer
Cujo.js
dermis
Spine.js
Ext.js
Sammy.js
JavascriptMVC
Epitome

•
•
•
•
•
•
•
•
•

Kendo UI
PureMVC
Olives
PlastronJS
Dijon
rAppid.js
Batman.js
React
Exoskeleton
Architectural Patterns
•
•
•
•
•
•

MVC
MVP
MVVM
MVA (Model View Adapter)
PAC (Presentation Abstraction Control)
HMVC (Hierarchical Model-View-Controller)
Why so Complicated
Angular Pattern?

MVW
Angular Pattern?

Model View Whatever
MV*
Angular Architecture
Demo Time
Pray to the Demo Gods
Views
• Views = HTML
• Directives are reusable components within the View; They
are similar to jQuery Plugins, but much more than that

• Declarative DSL – controversial and yet powerful
Directive Examples
<rating max="5" model=“data.rating" />
<tabs>
<tab title="Tab 1">…</tab>
<tab title="Tab 2">…</tab>
</tabs>
<span tooltip="{{model.text}}">…</span>
jQuery vs Angular
<div id="tabs">
<ul>
<li><a href="#tabs-1">Tab 1</a></li>
<li><a href="#tabs-2">Tab 2</a></li>
<li><a href="#tabs-3">Tab 3</a></li>
</ul>
<div id="tabs-1">...</div>
<div id="tabs-2">...</div>
<div id="tabs-3">...</div>
</div>
$( "#tabs" ).tabs();

<tabs>
<tab title="Tab 1">…</tab>
<tab title="Tab 2">…</tab>
<tab title="Tab 3">…</tab>
</tabs>
Controllers
• No Reference to DOM / Views
• The “code-behind” of the view
o What should happen if user does X
o Where do I get X from
Controller Example
app.controller("myController", function($scope, backendService) {
$scope.people = [
{ name: “Person 1”, city: “Sofia” },
{ name: “Person 2”, city: “Moscow” },
{ name: “Person 3”, city: “New York” }
];
$scope.addPerson = function(person) {
backendService.addPerson(person);
};
}
Models and Scope
• Model = data = JSON
• Scope is container for model, one scope per controller
• $scope.people = [
{ name: “Person 1”, city: “Sofia” },
{ name: “Person 2”, city: “Moscow” },
{ name: “Person 3”, city: “New York” }
]
Services
• Usually no reference to DOM
• Singletons, SRP, Dependency Injection

• How do I do X?
• Server communication, business logic, helpers, modal
dialogs, error handling, sharing data between controllers
Service Example
app.factory('myService', function($http, $q) {
return {
getAllItems: function() {
var deferred = $q.defer();
$http.get(“/api/getItems").success(function(data) {
deferred.resolve(data);
}).error(function(){
deferred.reject(“Error Message");
});
return deferred.promise;
}}}
Service Example (continued)
app.controller("myController", function($scope, myService) {
myService.getAllItems().then(function(data) {
$scope.items = data;
});
}

app.controller("myController2", function($scope, myService) {
$scope.items = myService.getAllItems();
}
Filters
• Simple formatters of data
•
•
•
•
•

currency
date
filter
json
limitTo

•
•
•
•

lowercase
number
orderBy
uppercase
Filter Example
myApp.filter('capitalize', function() {
return function(input, scope) {
return input.substring(0,1).toUpperCase() +
input.substring(1);
}
});
<div>{{person.Name | capitalize }}</div>
Conclusion
• SPA, Data-driven apps, CRUD
• The role of the server-side – HTML vs JSON:
o Don’t send HTML if you end up parsing it client-side to do
some calculations over it
o Don’t send JSON if all you do with it is just put it inside the
DOM
QA?
jivko@abilitics.com
@jivkopetiov
Thanks to our Sponsors:
Diamond Sponsor:

Gold Sponsors:

Silver Sponsors:

Technological Partners:
Bronze Partners:
Swag Sponsors:

Media Partners:

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (6)

A SOLID Design in InterSystems ObjectScript
A SOLID Design in InterSystems ObjectScriptA SOLID Design in InterSystems ObjectScript
A SOLID Design in InterSystems ObjectScript
 
Khan Academy Computer Science
Khan Academy Computer ScienceKhan Academy Computer Science
Khan Academy Computer Science
 
AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門
 
Bindings dojo
Bindings dojoBindings dojo
Bindings dojo
 
WebGL Fundamentals
WebGL FundamentalsWebGL Fundamentals
WebGL Fundamentals
 

Andere mochten auch

Five stages of grief: Evolving a multi-page web app to a single page application
Five stages of grief: Evolving a multi-page web app to a single page applicationFive stages of grief: Evolving a multi-page web app to a single page application
Five stages of grief: Evolving a multi-page web app to a single page application
Charles Knight
 

Andere mochten auch (9)

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
 
Architecture: ember.js and AngularJS
Architecture: ember.js and AngularJSArchitecture: ember.js and AngularJS
Architecture: ember.js and AngularJS
 
Integrating Ember.js into legacy applications
Integrating Ember.js into legacy applicationsIntegrating Ember.js into legacy applications
Integrating Ember.js into legacy applications
 
Comparatif des frameworks js mv
Comparatif des frameworks js mvComparatif des frameworks js mv
Comparatif des frameworks js mv
 
Five stages of grief: Evolving a multi-page web app to a single page application
Five stages of grief: Evolving a multi-page web app to a single page applicationFive stages of grief: Evolving a multi-page web app to a single page application
Five stages of grief: Evolving a multi-page web app to a single page application
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 

Ähnlich wie AngularJS - a radically different way of building Single Page Apps

Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)
Benjamin Howarth
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 

Ähnlich wie AngularJS - a radically different way of building Single Page Apps (20)

Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Evolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.jsEvolution of a cloud start up: From C# to Node.js
Evolution of a cloud start up: From C# to Node.js
 
Why try angularJS?
Why try angularJS?Why try angularJS?
Why try angularJS?
 
Node azure
Node azureNode azure
Node azure
 
Mini-Training: AngularJS
Mini-Training: AngularJSMini-Training: AngularJS
Mini-Training: AngularJS
 
The MEAN stack
The MEAN stack The MEAN stack
The MEAN stack
 
Node.js
Node.jsNode.js
Node.js
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
Serverless - Developers.IO 2019
Serverless - Developers.IO 2019Serverless - Developers.IO 2019
Serverless - Developers.IO 2019
 
Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)
 
What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
Going Offline with JS
Going Offline with JSGoing Offline with JS
Going Offline with JS
 
Building Better Web Apps with Angular.js (SXSW 2014)
Building Better Web Apps with Angular.js (SXSW 2014)Building Better Web Apps with Angular.js (SXSW 2014)
Building Better Web Apps with Angular.js (SXSW 2014)
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.io
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.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
 
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
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

AngularJS - a radically different way of building Single Page Apps

Hinweis der Redaktion

  1. Добре дошли на презентацията за AngularJSКазвам се живкоЩе си говорим за Angular – това е един Javascript framework който се появи някъде 2010-та година но една миналата година започна да става популярен.
  2. Има славата на не много лесен за използване фреймурк. затова ще започнем с един hello world – как се сетъпва проект и т.н.
  3. Gmail е по-скоро десктоп приложение отколкото уебсайт.
  4. Колко от вас сте ползвали в реален проект повече от тези фреймуърци сте ползвали.Колегите ми казаха задължително да сложа Batman JS
  5. Сякаш преди 5 години беше по-лесно да се пише javascript
  6. Controller – малка jsфункцияТука това трябва да го разберете щото после ще ви трябва
  7. Някой HTML Purist може би ще каже че да правим такива custom тагове в html е било лоша идея поради тая и тая причина. Но мисля че този пример говори сам за себе си. Пишейки такива custom тагове вие на практика разширявате HTML и можете да си направите Domain Specific Language.