SlideShare a Scribd company logo
ANGULARJS
ANGULARJS
AND BEYOND
Beyond AngularJS: Best practices and more
WHO AM I?
ARI LERNER, FULLSTACK.IO
Author of and
Author of afew others (
,
)
Teacher at ,
Co-founder of ,
Background in distributed computingand infrastructure
ng-book (https://ng-book.com) ng-newsletter
(http://ng-newsletter.com)
D3 on Angular
(http://leanpub/d3angularjs) RidingRails with AngularJS
(https://leanpub.com/angularjs-rails)
HackReactor (http://hackreactor.com) General
Assembly(http://generalassemb.ly)
Fullstack.io (http://fullstack.io) FullstackEdu
(https://fullstackedu.com)
Beyond AngularJS: Best practices and more
NG-BOOK.COM
FULLSTACKEDU
CORPORATE TRAINING
Allsized companies, large and small
1k+ totalparticipants
Refined for more than ayear
From DevOps to front-end
CORPORATE TRAINING
Contactus atus@fullstack.io
@auser
HACK REACTOR
Fantastic JavaScript-based course
Fantastic Angular curriculum
The harvard of programmingschools
AGENDA
1. HTML today
2. WhyAngular?
AGENDA
4. Community
5. Bestpractices
AGENDA
6. Town hall
HTML IS OLD
HTML IS OLD
OLDER THAN SOME OF US
<html>
<head>
<title>Reallybasichtml</title>
</head>
<body>
<h1id="headline">Helloworld</h1>
<spanclass="notice"></span>
<buttonid="buyBtn">Clickme</button>
</body>
</html>
Beyond AngularJS: Best practices and more
STATIC MARKUP
WHAT ABOUT WRITING WEB APPLICATIONS?
WHAT ABOUT WRITING WEB APPLICATIONS?
Interactivity?
Immediate response
Desktop, powerful
HOW DO WE ADD INTERACTION TODAY?
varcontent=document.findElementById('headline'),
newDiv =document.createElement('div');
//Dosomeinterestingthingshere
//withournewdivelements
content.appendChild(newDiv);
OR
JQUERY
<divclass="notice"></div>
<buttonid="exampleBuyBtn">Clickme</button>
$("button#buyBtn").on('click',function(event){
$('div.notice').html('Youclickedthebutton');
});
Click me
IMPERATIVE WRAPPER AROUND DOM
MANIPULATION
NOT A WEB APPLICATION MAKER
When all you have is ahammer everything looks
like aDOM to manipulate
WHAT'S WRONG WITH THIS PICTURE?
WHAT'S WRONG WITH THIS PICTURE?
tightcoupling
structureless code base
low-levelinteraction
BUILDING ACCESS TO DOM, NOT WEB
APPLICATION CODE
HOW RUDIMENTARY
OKAY, THEN WHAT SHOULD WE DO?
WHAT IF WE REINVENTED HTML?
HTML IS DECLARATIVE
SHOULDN'T OUR INTERACTION BE AS WELL?
Beyond AngularJS: Best practices and more
ENTER ANGULARJS
A MVW FRONT-END FRAMEWORK
A MVW FRONT-END FRAMEWORK
MODEL-VIEW-WHATEVER
Beyond AngularJS: Best practices and more
SUPER FAST
IN DEVELOPMENT AND PRODUCTION
Beyond AngularJS: Best practices and more
SPONSORED BY GOOGLE
AND IN PRODUCTION ALL-OVER-THE-INTERNET
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and more
Beyond AngularJS: Best practices and more
AND MANY MORE
COST EFFICIENT
FOR DEVELOPMENT AND PRODUCTION
Beyond AngularJS: Best practices and more
BUILT WITH TESTING IN MIND
BUILT WITH TESTING IN MIND
WITH FANTASTIC TOOLING
Beyond AngularJS: Best practices and more
HIGHLY ACTIVE COMMUNITY
AND MANY OPEN-SOURCE COMPONENTS
Beyond AngularJS: Best practices and more
COMPLETELY FREE
COMPLETELY FREE
SERIOUSLY, MIT LICENSED
Beyond AngularJS: Best practices and more
BEST PRACTICES
WHY BEST PRACTICES?
Cruftycode
Productlongevity
Optimization
Extensibility
Shareability
Maintainability
...
TEST TEST TEST
NEVER PREPEND MODULES WITH NG
Don'twantto collide with ngpackages
NEVER PREPEND MODULES WITH NG
angular.module('ngApp',[])
//...
INSTEAD
angular.module('inApp',[])
//...
MODULARIZE YOUR CODE
angular.module('inApp',[
'in.login',
'in.typeahead',
//...
]);
MODULARIZE YOUR CODE
Write once
MODULARIZE YOUR CODE
Write once, useoften
USE BROWSERIFY
//login/index.js
module.exports=
angular.module('inApp.login',[])
//main.js
angular.module('inApp',[
require('./login').name
]);
USE BROWSERIFY
Module-based dependencies allow our app to be highly
extensible and force us to develop with modules
USE UIROUTER
module.exports=
angular.module('inApp.root',[
'ui.router'
]);
USE UIROUTER
module.exports=angular.module('inApp.root',['ui.router'])
.config(function($stateProvider){
$stateProvider
.state('root',{
abstract:true,
url:'/'
})
.state('root.home',{
url:'',
views:{
'@':{
templateUrl:'/scripts/root/home.html'
}
}
})
//...
USE UIROUTER
State-based routingis far more powerfulthan simple URL-based.
It's extensible and gives us far-greater flexibility.
OPTIMIZE LATE
<divclass='profile'ng-repeat='userinusers'>
<spanclass="name">{{user.name}}</span>
<spanclass="email">{{user.email}}</span>
</div>
OPTIMIZE LATE
Preoptimization stunts growth and over-complicates an existing
code.
OPTIMIZE LATE
We can always optimize to infinity
USE .PROVIDER()WHEN
POSSIBLE
Providers make iteasyto distribute module-based services
USE .PROVIDER()WHEN
POSSIBLE
module.exports=angular.module('inApp',['ui.router'])
.provider('User',function(){
varbackendUrl='http://default.url;
this.setBackendUrl=function(url){
backendUrl=url;
};
this.$get=function($http){
returnthis;
};
})
USE .PROVIDER()WHEN
POSSIBLE
angular.module('inApp',['ui.router'])
.config(function(UserProvider){
UserProvider.setBackendUrl('http://intuit.com/api/v1');
});
SEARCH FIRST, WRITE LAST
Chances are someone has written somethingto do the thingyou
are wantingto do. Search for it, then write it.
USE GULP/GRUNT
//...
gulp.task('jshint',function(){
returngulp.src(path.join(config.src.scriptDir,config.src.scriptF
iles))
.pipe($.jshint(config.src.jshint))
.pipe($.jshint.reporter(stylish));
});
//...
USE GULP/GRUNT
Usingabuild-system provides consistantlycorrect, production-
readycode.
PAIR PROGRAM
DON'T USE []NOTATION, USE A PRE-
MINIFIER
Save your fingers
DON'T USE []NOTATION, USE A PRE-
MINIFIER
.controller(['UserService',function(UserService){
}]);
DON'T USE []NOTATION, USE A PRE-
MINIFIER
.controller(function(UserService){
});
USE XSRF/CSRF TOKENS/COOKIES
Cross-Site RequestForgerytokens allow the backend to ensure
arequestcomingin matches apreviouslyknown request
USE XSRF/CSRF TOKENS/COOKIES
module.exports=angular.module('inApp.login',[])
.config(function($httpProvider){
$httpProvider.defaults.xsrfHeaderName='X-INT-XSRF';
$httpProvider.defaults.xsrfCookieName='int-xsrftoken';
$httpProvider.defaults.headers.common['X-Requested-With']='XMLHt
tpRequest';
});
TEST TEST TEST
Testingensures we know what's goingon with our app
TEST TEST TEST
Unittest(as much as possible)
E2E test(for CI servers, mostly)
TEST TEST TEST
Use zones.js(or Angular 2.0) for better stacktraces
COMMUNITY
COMMUNITY
Angular's power comes from the highly-engaged community
BOOKS
TUTORIALS
TRAINING
Contactus atus@fullstack.io
@auser
COMMUNITY PLUGINS
WHAT CAN WE DO TO CONTRIBUTE?
WHAT CAN WE IMPLEMENT FOR OURSELVES?
I18N
I18N
Use angular-translate
ASK ME ANYTHING
THANK YOU
NG-BOOK.COM
630+ page book with allthis information and much much more.
The onlyconstantlyupdatingbook available for Angular today.

More Related Content

What's hot (20)

PDF
Developing a Demo Application with Angular 4 - J2I
Nader Debbabi
 
PDF
Up & running with ECMAScript6
Nir Kaufman
 
PDF
Top 7 Angular Best Practices to Organize Your Angular App
Katy Slemon
 
PPT
Angular Seminar-js
Mindfire Solutions
 
PDF
Data Flow Patterns in Angular 2 - Sebastian MĂźller
Sebastian Holstein
 
PDF
AngularJS in practice
Eugene Fidelin
 
PPTX
Angular js 2
Ran Wahle
 
PDF
A gently introduction to AngularJS
Gregor Woiwode
 
PDF
AngularJS
Hiten Pratap Singh
 
PPT
Angular 8
Sunil OS
 
PDF
Angular components
Sultan Ahmed
 
PPTX
Introduction to Angular js 2.0
Nagaraju Sangam
 
PDF
Introduction To Angular 4 - J2I
Nader Debbabi
 
PPTX
Angular 2 - Better or worse
Vladimir Georgiev
 
PPTX
AngularJS: Service, factory & provider
Corley S.r.l.
 
PDF
Angular js best practice
Matteo Scandolo
 
PDF
Angular 2 - The Next Framework
Commit University
 
PDF
Introduction to Angular 2
Naveen Pete
 
PDF
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
PDF
Angular Best Practices v2
Henry Tao
 
Developing a Demo Application with Angular 4 - J2I
Nader Debbabi
 
Up & running with ECMAScript6
Nir Kaufman
 
Top 7 Angular Best Practices to Organize Your Angular App
Katy Slemon
 
Angular Seminar-js
Mindfire Solutions
 
Data Flow Patterns in Angular 2 - Sebastian MĂźller
Sebastian Holstein
 
AngularJS in practice
Eugene Fidelin
 
Angular js 2
Ran Wahle
 
A gently introduction to AngularJS
Gregor Woiwode
 
AngularJS
Hiten Pratap Singh
 
Angular 8
Sunil OS
 
Angular components
Sultan Ahmed
 
Introduction to Angular js 2.0
Nagaraju Sangam
 
Introduction To Angular 4 - J2I
Nader Debbabi
 
Angular 2 - Better or worse
Vladimir Georgiev
 
AngularJS: Service, factory & provider
Corley S.r.l.
 
Angular js best practice
Matteo Scandolo
 
Angular 2 - The Next Framework
Commit University
 
Introduction to Angular 2
Naveen Pete
 
Gettings started with the superheroic JavaScript library AngularJS
Armin Vieweg
 
Angular Best Practices v2
Henry Tao
 

Similar to Beyond AngularJS: Best practices and more (20)

PPTX
Angular patterns
Premkumar M
 
PDF
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
kiciunonge
 
PDF
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
mehiicniode
 
PDF
Building Better Web Apps with Angular.js (SXSW 2014)
kbekessy
 
PPTX
AngularJS One Day Workshop
Shyam Seshadri
 
PDF
AngularJS in Production (CTO Forum)
Alex Ross
 
PPTX
Angular js for Beginnners
Santosh Kumar Kar
 
PDF
Angular js mobile jsday 2014 - Verona 14 may
Luciano Amodio
 
PDF
Angular js gtg-27feb2013
Nitya Narasimhan
 
PDF
Getting Started With AngularJS
Edureka!
 
PDF
AngularJS for Beginners
Edureka!
 
PDF
Angular JS - Develop Responsive Single Page Application
Edureka!
 
PDF
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Edureka!
 
PDF
Getting Started with AngularJS
Edureka!
 
PDF
AngularJS best-practices
Henry Tao
 
PPTX
AngularJS Introduction (Talk given on Aug 5 2013)
Abhishek Anand
 
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
PPTX
Angular js workshop
Rolands Krumbergs
 
PPTX
Training On Angular Js
Mahima Radhakrishnan
 
PDF
Angularjs tutorial
HarikaReddy115
 
Angular patterns
Premkumar M
 
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
kiciunonge
 
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
mehiicniode
 
Building Better Web Apps with Angular.js (SXSW 2014)
kbekessy
 
AngularJS One Day Workshop
Shyam Seshadri
 
AngularJS in Production (CTO Forum)
Alex Ross
 
Angular js for Beginnners
Santosh Kumar Kar
 
Angular js mobile jsday 2014 - Verona 14 may
Luciano Amodio
 
Angular js gtg-27feb2013
Nitya Narasimhan
 
Getting Started With AngularJS
Edureka!
 
AngularJS for Beginners
Edureka!
 
Angular JS - Develop Responsive Single Page Application
Edureka!
 
Webinar on Angular JS titled 'Develop Responsive Single Page Application'
Edureka!
 
Getting Started with AngularJS
Edureka!
 
AngularJS best-practices
Henry Tao
 
AngularJS Introduction (Talk given on Aug 5 2013)
Abhishek Anand
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Angular js workshop
Rolands Krumbergs
 
Training On Angular Js
Mahima Radhakrishnan
 
Angularjs tutorial
HarikaReddy115
 
Ad

Recently uploaded (20)

PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Ad

Beyond AngularJS: Best practices and more