SlideShare a Scribd company logo
Angular.JS
Advanced Angular.JS - GDayX VN 2013
About me
Nicolas Embleton, French in Ho Chi Minh City
●
●
●
●

2005 - Software Engineer and System Architect, working on legacy tech
stacks (C++, OpenGL, Java, ...) then quickly Web (PHP)
2009 - Founded a Mobile Development Company of 30 individuals
2011 - Started Datafield Startup, Co-founder, CTO
2013 - Started the Javascript Ho Chi Minh City meetup, Getting active in
Startup Vietnamese scene to support and mentor young talents
Agenda
●
●
●
●
●
●
●
●

Quick Intro
Bootstrapping
Why Angular?
Main features, and why it's awesome
Best practices
Testing, tooling
And SEO?
Final words
Intro (quick)
From Wikipedia:
AngularJS is built around the belief that declarative programming should be used for building UIs
and wiring software components, while imperative programming is excellent for
expressing

business logic. The framework adapts and extends traditional HTML to better serve dynamic

content through

two-way data-binding that allows for the automatic synchronization of models and views. As a result,

AngularJS deemphasizes DOM manipulation and improves testability.
Angular JS quick review
●
●
●
●
●
●
●

Templating
Model View Controller (MVC)
Extends HTML (very flexible)
2-ways Data-binding
Very reusable (if you follow best practices)
Improves testability (because it is reusable)
Provides routing, history, jqLite, ...
Bootstrapping
● Using angular-seeds
○
○
○

git clone https://github.com/angular/angular-seed.git
node scripts/web-server.js
open http://localhost:8000/app/index.html

● Using yeoman (excellent workflow tool)
○
○
○
○
○

(sudo) npm install -g yo
(sudo) npm install -g generator-angular
yo angular
bower install angular-ui
grunt server
Now, the meat, the main features
●
●
●
●
●
●

Templating
Routing
2-ways data-binding
Directives
Services
Inter-components Communication
Templating
● Models
○ 2-way binding
○ Easy property mapping

● Built-in directives
○ ngView
■ Where the routing happens
○ ngRepeat
■ Iterator
○ ngIf
○ ngSwitch
Templating - Conditional with ngIf
<div ng-repeat="message in data.messages" ng-class="message.type">
<hr>
<div ng-if="showFrom(message)">
<div>From: {{message.from.name}}</div>
</div>
<div ng-if="showCreatedBy(message)">
<div>Created by: {{message.createdBy.name}}</div>
</div>
<div ng-if="showTo(message)">
<div>To: {{message.to.name}}</div>
</div>
</div>​
Templating - Nested repeat
<div ng-repeat="group in groups"><!-- 1st ng-repeat level -->
<h2>{{ group.label }}</h2>
<ul>
<li ng-repeat="friend in group.friends">
<!-- 2nd ng-repeat level -->
{{ friend.name }}
</li>
</ul><!-- END: Inner ngRepeat. -->
</div><!-- END: Outer ngRepeat. -->​
Templating - Example 2 - Switch
<div ng-switch on="selection" >
<div ng-switch-when="settings">Settings Div</div>
<span ng-switch-when="home">Home Span</span>
<span ng-switch-default>default</span>
</div>​
Example 2.2 - Switch with 2-way bind
<div ng-controller ="Ctrl">
<select ng-model="selection" ng-options ="item for item in items" >
</select>
<tt>selection={{selection}} </tt>
<hr/>
<div class="animate-switch-container"
ng-switch on="selection">
<div ng-switch-when ="settings" >Settings Div </div>
<div ng-switch-when ="home">Home Span</div>
<div ng-switch-default >default</div>
</div>
</div>
Templating - Simple ngRepeat
<li ng-repeat="item in items">
Item: {{ item }}
</li>
Templating - Complex ngRepeat
<header ng-repeat-start="item in items">
Header {{ item }}
</header>
<div class="body">
Body {{ item }}
</div>
<footer ng-repeat-end>
Footer {{ item }}
</footer>
Compiling
// compile the new DOM and link it to the current scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
Templating - Routing
●
●
●
●

Happens in ngView
Routing is a very powerful feature
Allows to update "pieces" of the page
Can stream files from disk to make it truly
isolated
2-ways data-binding
●
●
●
●

●

Becoming more standard, thanks to frameworks like Ember.js or Angular.js
Linking 2 fields for synchronization purpose
Linking data to model
Automatically updating the template as data is changed
○ Arrays / Collections
○ Inputs
○ etc…
Example
2-ways data-binding, example
<input type="text" ng-model="title" style="width: 90%"/>
<div ng-app="myapp">
<div ng-controller="mycontroller">
Title: {{ title }} <!-- 2-way data binding -->
<hr>
<div class="zippy" zippy-title="title"></div>
</div>
</div>​
Directives
● Angular.js killer feature
● Great deal of re-usability
● Just look for directives at ngmodules.org
Restricting Directives
●
●
●
●
●

"E": Element, <my-directive>
"A": Attribute, <div my-directive>
"C": Class, <div class="my-directive">
"M": Comment: <!-- directive: my-directive exp -->
Combine (e.g. "EA") for more flexibility
Communicating between directives
● Many design patterns
● The "backbonier"
○ the emitter and the receiver

● A more connected example
○ the directive combinations and controller sharing
Communicating between directives
app.directive('directiveA', function($rootScope){ // $rootScope = App Scope
return function(scope, element, attrs) { // scope = Current scope (ctrl)
$rootScope.$on('someEvent', function(){
// From here we can react anytime there's an event "someEvent" triggered
});
};
});​
Communicating between directives
app.directive('gdayx', function() { // Creating the directive
return {
restrict: 'E',
controller: function($scope) {

// Restricted to "element"
// Creating the controller of the directive

$scope.what = "";

// Local data

this.is = function(what) {

// External accessor

$scope.what = what;
}
},
link: function($scope, $element){
$element.bind("click", function() { // Binding on click
alert("GDayX is "+$scope.what); // Getting content from the Controller.
});
}
}

​

});
Communicating between directives
// This directive will "send" data to the first directive
app.directive('is', function() {
// Creating the directive
return {
require: "gdayx",
// Requiring the "gdayx" controller
restrict: 'A',
// Restricting to "attribute"
link: function(scope, element, attrs, gdayxCtrl) {
// gdayxCtrl from the "require: 'gdayx'"
gdayxCtrl.is(attrs.is); // Passing value to the "gdayx" controller
}
}
});​
AngularJS - Why is it awesome?
●
●
●
●
●

Mature, production-ready
Feature-rich
The design and what it allows
Strong support from giants like Google
A lot of solid companies are embracing it
○ Ebay Commerce Network
○ DoubleClick (Google) - Marketing Manager &
Planner
○ YouTube APP on PS3
Best Practices
● Organize the code well (Captain Obvious!)
● Organize modules by feature
angular.module('users', ['utilities']);
angular.module('groups', ['utilities']);
angular.module('mainApp', ['users', 'groups']);

● Use the reusability as much as possible
● Use the testability as much as possible
○ TDD
○ BDD?
Testing, tooling
●
●
●
●
●
●

Yeoman
○ Super workflow tool and generator/scaffolder
Batarang
○ Chrome Debugger Extension, (A must have), link
Grunt
○ Task runner
Bower
○ Package Manager for JS Libraries
Protractor, Karma
○ Test Runner
Jasmine, Mocha
○ Test Frameworks
And SEO?
● Google "Snapshot" famous technic
○ _escaped_fragment_
○ Turns this:
■

http://prerender.io/getting-started#html5-pushstate

○ Into this:
■

http://prerender.io/getting-started?_escaped_fragment_=html5pushstate

● prerender.io/ - Open Source project
● brombone.com/ - Commercial project
Enterprise project with Angular?
● YES
● BUT
Enterprise project with Angular?
● YES
● BUT
○ Follow best practices (easier said than done)
○ System Architecture is KEY to a solid system
○ As "Agile" would advise, always try to go for simpler
but "well-thought" "team-friendly"designs.
Enterprise project with Angular?
● An example Architecture
Backend
(legacy)

A/B t

esting

Legacy Front End

?

Experimental Front
End

DB
Backend
(experimental)

Server-side team realm

Experimental Front
End 2

Front-End team realm
Final Words
● Angular 1.0.x is mature
● Angular 1.2+ will bring more awesomeness
○ Better and Fluid Animations (js/css3)
○ More flexibility and functionalities
■
■
■

$interval: add a service wrapping setInterval
Event directives: add ngCopy, ngCut, and ngPaste
jQuery 1.10.x support
DEMO
(if time permits :)
Bootstrapped app
● Let's see a quick Angular App
● Bootstrapped from Yeoman
Where you can find me:
Author: Nicolas Embleton @: nicolas.embleton@gmail.com
Presentation made for “Google Developer Day GDayX 2013 Vietnam”
You can follow me at:
● https://plus.google.com/+NicolasEmbleton
● https://twitter.com/nicolasembleton
And the Javascript Ho Chi Minh City Meetup:
● http://meetup.com/JavaScript-Ho-Chi-Minh-City/
● https://www.facebook.com/JavaScriptHCMC
● https://plus.google.com/communities/116105314977285194967
Resources
Learning
●
●
●
●

Learning AngularJS by the example (+60 minutes-ish training video)
http://www.nganimate.org/
https://github.com/angular-ui/ui-router
○ It's a full "nested-view" library
http://docs.angularjs.org/guide/dev_guide.templates.databinding

Reusable Components
●
●

http://ngmodules.org/
http://www.directiv.es/

More Related Content

What's hot

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
Peter Drinnan
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
Ran Wahle
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
FITC
 
Angularjs
AngularjsAngularjs
Angularjs
Vincenzo Ferrari
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
Ran Mizrahi
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
Yakov Fain
 
AngularJs $provide API internals & circular dependency problem.
AngularJs $provide API internals & circular dependency problem.AngularJs $provide API internals & circular dependency problem.
AngularJs $provide API internals & circular dependency problem.
Yan Yankowski
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
Phan Tuan
 
Workshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte IWorkshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte I
Visual Engineering
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
Ran Mizrahi
 
AngularJs
AngularJsAngularJs
AngularJs
syam kumar kk
 
Angular 1.x in action now
Angular 1.x in action nowAngular 1.x in action now
Angular 1.x in action now
GDG Odessa
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
Ran Mizrahi
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
Scott Becker
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
Visual Engineering
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JS
Nicolas Embleton
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
Rainer Stropek
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
Yakov Fain
 

What's hot (20)

Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
 
Angularjs
AngularjsAngularjs
Angularjs
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
AngularJs $provide API internals & circular dependency problem.
AngularJs $provide API internals & circular dependency problem.AngularJs $provide API internals & circular dependency problem.
AngularJs $provide API internals & circular dependency problem.
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
Workshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte IWorkshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte I
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
AngularJs
AngularJsAngularJs
AngularJs
 
Angular 1.x in action now
Angular 1.x in action nowAngular 1.x in action now
Angular 1.x in action now
 
Intro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran MizrahiIntro To JavaScript Unit Testing - Ran Mizrahi
Intro To JavaScript Unit Testing - Ran Mizrahi
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JS
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 

Viewers also liked

Angular js - the beginning
Angular js - the beginningAngular js - the beginning
Angular js - the beginning
A.K.M. Ahsrafuzzaman
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
George Nguyen
 
Angular 1.5 Components
Angular 1.5 ComponentsAngular 1.5 Components
Angular 1.5 Components
José Barbosa
 
Scope demystified - AngularJS
Scope demystified - AngularJSScope demystified - AngularJS
Scope demystified - AngularJS
Sumanth krishna
 
29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions
Arc & Codementor
 
RUELCASAVA
RUELCASAVARUELCASAVA
RUELCASAVA
ruel casava
 
Terrazzo adhesive
Terrazzo adhesiveTerrazzo adhesive
Terrazzo adhesive
ola olu
 
Adeyinka igbinoba's resume
Adeyinka igbinoba's resumeAdeyinka igbinoba's resume
Adeyinka igbinoba's resume
Adeyinka Igbinoba
 
Единый урок
Единый урокЕдиный урок
Единый урок
Лицей №1158
 
New company catalog 2016
New company catalog 2016New company catalog 2016
New company catalog 2016
Luis Lara
 
Peter VanPelt
Peter VanPeltPeter VanPelt
Peter VanPelt
OPUNITE
 
ACOOK_portfolio
ACOOK_portfolioACOOK_portfolio
ACOOK_portfolio
Alexandra Cook
 
Broadband Network Presentation
Broadband Network PresentationBroadband Network Presentation
Broadband Network Presentation
Muhammad Faisal
 
ご依頼の流れ
ご依頼の流れご依頼の流れ
ご依頼の流れ
abeoffice
 
Τέχνες και Γράμματα στην Ελλάδα του 1880
Τέχνες και Γράμματα στην Ελλάδα του 1880Τέχνες και Γράμματα στην Ελλάδα του 1880
Τέχνες και Γράμματα στην Ελλάδα του 1880
Κατερίνα Τραγούδα
 
用 增額終身壽險作 退休規劃
用 增額終身壽險作 退休規劃用 增額終身壽險作 退休規劃
用 增額終身壽險作 退休規劃
康 明發
 

Viewers also liked (17)

Angular js - the beginning
Angular js - the beginningAngular js - the beginning
Angular js - the beginning
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
Angular 1.5 Components
Angular 1.5 ComponentsAngular 1.5 Components
Angular 1.5 Components
 
Scope demystified - AngularJS
Scope demystified - AngularJSScope demystified - AngularJS
Scope demystified - AngularJS
 
29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions29 Essential AngularJS Interview Questions
29 Essential AngularJS Interview Questions
 
RUELCASAVA
RUELCASAVARUELCASAVA
RUELCASAVA
 
леся українка
леся українкалеся українка
леся українка
 
Terrazzo adhesive
Terrazzo adhesiveTerrazzo adhesive
Terrazzo adhesive
 
Adeyinka igbinoba's resume
Adeyinka igbinoba's resumeAdeyinka igbinoba's resume
Adeyinka igbinoba's resume
 
Единый урок
Единый урокЕдиный урок
Единый урок
 
New company catalog 2016
New company catalog 2016New company catalog 2016
New company catalog 2016
 
Peter VanPelt
Peter VanPeltPeter VanPelt
Peter VanPelt
 
ACOOK_portfolio
ACOOK_portfolioACOOK_portfolio
ACOOK_portfolio
 
Broadband Network Presentation
Broadband Network PresentationBroadband Network Presentation
Broadband Network Presentation
 
ご依頼の流れ
ご依頼の流れご依頼の流れ
ご依頼の流れ
 
Τέχνες και Γράμματα στην Ελλάδα του 1880
Τέχνες και Γράμματα στην Ελλάδα του 1880Τέχνες και Γράμματα στην Ελλάδα του 1880
Τέχνες και Γράμματα στην Ελλάδα του 1880
 
用 增額終身壽險作 退休規劃
用 增額終身壽險作 退休規劃用 增額終身壽險作 退休規劃
用 增額終身壽險作 退休規劃
 

Similar to Nicolas Embleton, Advanced Angular JS

gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjs
gdgvietnam
 
Angular JS Basics.
Angular JS Basics.Angular JS Basics.
Angular JS Basics.
Tharindu Prabhath Ranathunga
 
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
Stéphane Bégaudeau
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
Gianluca Cacace
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
Marco Vito Moscaritolo
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
Tricode (part of Dept)
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
Mario Heiderich
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
Alive Kuo
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
Horacio Gonzalez
 
Extending CMS Made Simple
Extending CMS Made SimpleExtending CMS Made Simple
Extending CMS Made Simple
cmsmssjg
 
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
murtazahaveliwala
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
Vlad Fedosov
 
React django
React djangoReact django
React django
Heber Silva
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA
 
Grails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duoGrails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duo
Rubén Mondéjar Andreu
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
Udi Bauman
 
Perl Tools for Productivity
Perl Tools for ProductivityPerl Tools for Productivity
Perl Tools for Productivity
Tudor Constantin
 
AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
Lorenzo Dematté
 

Similar to Nicolas Embleton, Advanced Angular JS (20)

gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjs
 
Angular JS Basics.
Angular JS Basics.Angular JS Basics.
Angular JS Basics.
 
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
 
AngularJS Workshop
AngularJS WorkshopAngularJS Workshop
AngularJS Workshop
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
 
Extending CMS Made Simple
Extending CMS Made SimpleExtending CMS Made Simple
Extending CMS Made Simple
 
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
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
React django
React djangoReact django
React django
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Grails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duoGrails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duo
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Perl Tools for Productivity
Perl Tools for ProductivityPerl Tools for Productivity
Perl Tools for Productivity
 
AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
 

More from JavaScript Meetup HCMC

Writing testable js [by Ted Piotrowski]
Writing testable js [by Ted Piotrowski]Writing testable js [by Ted Piotrowski]
Writing testable js [by Ted Piotrowski]
JavaScript Meetup HCMC
 
Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.   Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.
JavaScript Meetup HCMC
 
[Js hcm] Java script- Testing the awesome
[Js hcm] Java script- Testing the awesome[Js hcm] Java script- Testing the awesome
[Js hcm] Java script- Testing the awesome
JavaScript Meetup HCMC
 
Knockout js (Dennis Haney)
Knockout js (Dennis Haney)Knockout js (Dennis Haney)
Knockout js (Dennis Haney)
JavaScript Meetup HCMC
 
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
JavaScript Meetup HCMC
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
JavaScript Meetup HCMC
 
Khanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solutionKhanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solution
JavaScript Meetup HCMC
 
Nicolas-Embleton - Deploying node.js with forever and nginx
Nicolas-Embleton  - Deploying node.js with forever and nginxNicolas-Embleton  - Deploying node.js with forever and nginx
Nicolas-Embleton - Deploying node.js with forever and nginx
JavaScript Meetup HCMC
 

More from JavaScript Meetup HCMC (8)

Writing testable js [by Ted Piotrowski]
Writing testable js [by Ted Piotrowski]Writing testable js [by Ted Piotrowski]
Writing testable js [by Ted Piotrowski]
 
Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.   Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.
 
[Js hcm] Java script- Testing the awesome
[Js hcm] Java script- Testing the awesome[Js hcm] Java script- Testing the awesome
[Js hcm] Java script- Testing the awesome
 
Knockout js (Dennis Haney)
Knockout js (Dennis Haney)Knockout js (Dennis Haney)
Knockout js (Dennis Haney)
 
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
Debugging JavaScript (by Thomas Bindzus, Founder, Vinagility & Thanh Loc Vo, ...
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
 
Khanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solutionKhanh-Nguyen - Gearman - distributed process solution
Khanh-Nguyen - Gearman - distributed process solution
 
Nicolas-Embleton - Deploying node.js with forever and nginx
Nicolas-Embleton  - Deploying node.js with forever and nginxNicolas-Embleton  - Deploying node.js with forever and nginx
Nicolas-Embleton - Deploying node.js with forever and nginx
 

Recently uploaded

“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
 
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
 
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
 
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
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
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
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
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
 
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
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

“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”
 
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...
 
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
 
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
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
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...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
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
 
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
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Nicolas Embleton, Advanced Angular JS

  • 2. About me Nicolas Embleton, French in Ho Chi Minh City ● ● ● ● 2005 - Software Engineer and System Architect, working on legacy tech stacks (C++, OpenGL, Java, ...) then quickly Web (PHP) 2009 - Founded a Mobile Development Company of 30 individuals 2011 - Started Datafield Startup, Co-founder, CTO 2013 - Started the Javascript Ho Chi Minh City meetup, Getting active in Startup Vietnamese scene to support and mentor young talents
  • 3. Agenda ● ● ● ● ● ● ● ● Quick Intro Bootstrapping Why Angular? Main features, and why it's awesome Best practices Testing, tooling And SEO? Final words
  • 4. Intro (quick) From Wikipedia: AngularJS is built around the belief that declarative programming should be used for building UIs and wiring software components, while imperative programming is excellent for expressing business logic. The framework adapts and extends traditional HTML to better serve dynamic content through two-way data-binding that allows for the automatic synchronization of models and views. As a result, AngularJS deemphasizes DOM manipulation and improves testability.
  • 5. Angular JS quick review ● ● ● ● ● ● ● Templating Model View Controller (MVC) Extends HTML (very flexible) 2-ways Data-binding Very reusable (if you follow best practices) Improves testability (because it is reusable) Provides routing, history, jqLite, ...
  • 6. Bootstrapping ● Using angular-seeds ○ ○ ○ git clone https://github.com/angular/angular-seed.git node scripts/web-server.js open http://localhost:8000/app/index.html ● Using yeoman (excellent workflow tool) ○ ○ ○ ○ ○ (sudo) npm install -g yo (sudo) npm install -g generator-angular yo angular bower install angular-ui grunt server
  • 7. Now, the meat, the main features ● ● ● ● ● ● Templating Routing 2-ways data-binding Directives Services Inter-components Communication
  • 8. Templating ● Models ○ 2-way binding ○ Easy property mapping ● Built-in directives ○ ngView ■ Where the routing happens ○ ngRepeat ■ Iterator ○ ngIf ○ ngSwitch
  • 9. Templating - Conditional with ngIf <div ng-repeat="message in data.messages" ng-class="message.type"> <hr> <div ng-if="showFrom(message)"> <div>From: {{message.from.name}}</div> </div> <div ng-if="showCreatedBy(message)"> <div>Created by: {{message.createdBy.name}}</div> </div> <div ng-if="showTo(message)"> <div>To: {{message.to.name}}</div> </div> </div>​
  • 10. Templating - Nested repeat <div ng-repeat="group in groups"><!-- 1st ng-repeat level --> <h2>{{ group.label }}</h2> <ul> <li ng-repeat="friend in group.friends"> <!-- 2nd ng-repeat level --> {{ friend.name }} </li> </ul><!-- END: Inner ngRepeat. --> </div><!-- END: Outer ngRepeat. -->​
  • 11. Templating - Example 2 - Switch <div ng-switch on="selection" > <div ng-switch-when="settings">Settings Div</div> <span ng-switch-when="home">Home Span</span> <span ng-switch-default>default</span> </div>​
  • 12. Example 2.2 - Switch with 2-way bind <div ng-controller ="Ctrl"> <select ng-model="selection" ng-options ="item for item in items" > </select> <tt>selection={{selection}} </tt> <hr/> <div class="animate-switch-container" ng-switch on="selection"> <div ng-switch-when ="settings" >Settings Div </div> <div ng-switch-when ="home">Home Span</div> <div ng-switch-default >default</div> </div> </div>
  • 13. Templating - Simple ngRepeat <li ng-repeat="item in items"> Item: {{ item }} </li>
  • 14. Templating - Complex ngRepeat <header ng-repeat-start="item in items"> Header {{ item }} </header> <div class="body"> Body {{ item }} </div> <footer ng-repeat-end> Footer {{ item }} </footer>
  • 15. Compiling // compile the new DOM and link it to the current scope. // NOTE: we only compile .childNodes so that // we don't get into infinite loop compiling ourselves $compile(element.contents())(scope);
  • 16. Templating - Routing ● ● ● ● Happens in ngView Routing is a very powerful feature Allows to update "pieces" of the page Can stream files from disk to make it truly isolated
  • 17. 2-ways data-binding ● ● ● ● ● Becoming more standard, thanks to frameworks like Ember.js or Angular.js Linking 2 fields for synchronization purpose Linking data to model Automatically updating the template as data is changed ○ Arrays / Collections ○ Inputs ○ etc… Example
  • 18. 2-ways data-binding, example <input type="text" ng-model="title" style="width: 90%"/> <div ng-app="myapp"> <div ng-controller="mycontroller"> Title: {{ title }} <!-- 2-way data binding --> <hr> <div class="zippy" zippy-title="title"></div> </div> </div>​
  • 19. Directives ● Angular.js killer feature ● Great deal of re-usability ● Just look for directives at ngmodules.org
  • 20. Restricting Directives ● ● ● ● ● "E": Element, <my-directive> "A": Attribute, <div my-directive> "C": Class, <div class="my-directive"> "M": Comment: <!-- directive: my-directive exp --> Combine (e.g. "EA") for more flexibility
  • 21. Communicating between directives ● Many design patterns ● The "backbonier" ○ the emitter and the receiver ● A more connected example ○ the directive combinations and controller sharing
  • 22. Communicating between directives app.directive('directiveA', function($rootScope){ // $rootScope = App Scope return function(scope, element, attrs) { // scope = Current scope (ctrl) $rootScope.$on('someEvent', function(){ // From here we can react anytime there's an event "someEvent" triggered }); }; });​
  • 23. Communicating between directives app.directive('gdayx', function() { // Creating the directive return { restrict: 'E', controller: function($scope) { // Restricted to "element" // Creating the controller of the directive $scope.what = ""; // Local data this.is = function(what) { // External accessor $scope.what = what; } }, link: function($scope, $element){ $element.bind("click", function() { // Binding on click alert("GDayX is "+$scope.what); // Getting content from the Controller. }); } } ​ });
  • 24. Communicating between directives // This directive will "send" data to the first directive app.directive('is', function() { // Creating the directive return { require: "gdayx", // Requiring the "gdayx" controller restrict: 'A', // Restricting to "attribute" link: function(scope, element, attrs, gdayxCtrl) { // gdayxCtrl from the "require: 'gdayx'" gdayxCtrl.is(attrs.is); // Passing value to the "gdayx" controller } } });​
  • 25. AngularJS - Why is it awesome? ● ● ● ● ● Mature, production-ready Feature-rich The design and what it allows Strong support from giants like Google A lot of solid companies are embracing it ○ Ebay Commerce Network ○ DoubleClick (Google) - Marketing Manager & Planner ○ YouTube APP on PS3
  • 26. Best Practices ● Organize the code well (Captain Obvious!) ● Organize modules by feature angular.module('users', ['utilities']); angular.module('groups', ['utilities']); angular.module('mainApp', ['users', 'groups']); ● Use the reusability as much as possible ● Use the testability as much as possible ○ TDD ○ BDD?
  • 27. Testing, tooling ● ● ● ● ● ● Yeoman ○ Super workflow tool and generator/scaffolder Batarang ○ Chrome Debugger Extension, (A must have), link Grunt ○ Task runner Bower ○ Package Manager for JS Libraries Protractor, Karma ○ Test Runner Jasmine, Mocha ○ Test Frameworks
  • 28. And SEO? ● Google "Snapshot" famous technic ○ _escaped_fragment_ ○ Turns this: ■ http://prerender.io/getting-started#html5-pushstate ○ Into this: ■ http://prerender.io/getting-started?_escaped_fragment_=html5pushstate ● prerender.io/ - Open Source project ● brombone.com/ - Commercial project
  • 29. Enterprise project with Angular? ● YES ● BUT
  • 30. Enterprise project with Angular? ● YES ● BUT ○ Follow best practices (easier said than done) ○ System Architecture is KEY to a solid system ○ As "Agile" would advise, always try to go for simpler but "well-thought" "team-friendly"designs.
  • 31. Enterprise project with Angular? ● An example Architecture Backend (legacy) A/B t esting Legacy Front End ? Experimental Front End DB Backend (experimental) Server-side team realm Experimental Front End 2 Front-End team realm
  • 32. Final Words ● Angular 1.0.x is mature ● Angular 1.2+ will bring more awesomeness ○ Better and Fluid Animations (js/css3) ○ More flexibility and functionalities ■ ■ ■ $interval: add a service wrapping setInterval Event directives: add ngCopy, ngCut, and ngPaste jQuery 1.10.x support
  • 34. Bootstrapped app ● Let's see a quick Angular App ● Bootstrapped from Yeoman
  • 35. Where you can find me: Author: Nicolas Embleton @: nicolas.embleton@gmail.com Presentation made for “Google Developer Day GDayX 2013 Vietnam” You can follow me at: ● https://plus.google.com/+NicolasEmbleton ● https://twitter.com/nicolasembleton And the Javascript Ho Chi Minh City Meetup: ● http://meetup.com/JavaScript-Ho-Chi-Minh-City/ ● https://www.facebook.com/JavaScriptHCMC ● https://plus.google.com/communities/116105314977285194967
  • 36. Resources Learning ● ● ● ● Learning AngularJS by the example (+60 minutes-ish training video) http://www.nganimate.org/ https://github.com/angular-ui/ui-router ○ It's a full "nested-view" library http://docs.angularjs.org/guide/dev_guide.templates.databinding Reusable Components ● ● http://ngmodules.org/ http://www.directiv.es/