SlideShare a Scribd company logo
Your Cloud.
Your Business.
Advanced Angular Tips and Tricks
Jeremy Likness
Principal Architect
@JeremyLikness
www.ivision.com
TODAY’S AGENDA
1. Background Where did these tips and tricks come from?
2. Integration Tips for integrating existing JavaScript code
3. Best Practices Lessons learned in the trenches
4. Debugging Debugging Angular apps
5. Performance Writing Angular apps that scale and perform well
BACKGROUND
BACKGROUND
• Several Enterprise AngularJS Projects
• Largest Project:
• 80,000+ lines of TypeScript code (generated JavaScript even bigger)
• 100s of controllers, services, filters, and directives
• Global team of 25+ developers
• 2 years of development before go-live
• Exceeded client expectations for performance in most areas
• How much content have you read began with “I was tinkering
with…” or “I was exploring…”?
Lessons Learned
• It’s important you pick a code structure. There is no “best one” but it is
important to have one. We did:
/controllers
../common
../products
../customers
/directives
../common
../products
• Decouple from $scope as fast as you can!
• Don’t rely on $scope hierarchy/inheritance
• Use services for communication
• Use controller as syntax
• Maxim of Least Angular
• Test Early, and Test Often!
• For large teams, consider TypeScript
DEMO: Lessons Learned
INTEGRATION
INTEGRATION
• Register and reuse third-party components with Angular’s
dependency injection system
• Wrap third-party components to trigger digest
• Extend third-party components to be “Angular aware”
• Wrap third-party controls with Angular directives
• Create reusable libraries with Angular modules
• Consume third-party modules with Angular
DEMO: Integration
BEST PRACTICES
BEST PRACTICES
• $scope (addressed earlier)
• Use values (or constants) where it makes sense
• Wrap APIs in services and understand interceptors
• Use $log and $exceptionHandler
• Apply behaviors by decorating existing services with $provide
• Define code using Angular’s extend
• Lazy-load components with the injector when they aren’t
commonly used
• Use route’s “resolve” to guarantee asynchronous context
DEMO: Best Practices
DEBUGGING
DEBUGGING
• All major browsers provide F12 “debug tools”
• In Chrome, you can inspect/select an element and reference it as $0
• angular.element(x) wraps a DOM element as a node with Angular
functions e.g. angular.element($0)
• scope()
• isolateScope()
• controller()
• injector()
• Expand objects then navigate to source and set breakpoints/watches
• Batarang
DEMO: Debugging
PERFORMANCE
PERFORMANCE
• Batarang
• Zone to instrument
• Bindonce or new :: prefix
• Double-list approach
• ng-if vs. ng-show
• Measure twice, cut once!
DEMO: Performance
Questions?
Source for this deck
https://github.com/JeremyLikness/AngularTipsAndTricks
Running example for this deck
http://jeremylikness.github.io/AngularTipsAndTricks/
Mastering AngularJS Course: fundamentals, scope, digest, filters, dependency injection,
services, web services, routes, directives, testing, debugging and performance
https://www.wintellectnow.com/course/detail/mastering-angularjs
Jeremy Likness, Principal Architect @JeremyLikness

More Related Content

PPTX
Angular from a Different Angle
PPTX
C# Async/Await Explained
PPTX
Single Page Applications: Your Browser is the OS!
PPTX
Back to the ng2 Future
PPTX
Let's Build an Angular App!
PPTX
Angle Forward with TypeScript
PPTX
Valentine with Angular js - Introduction
PDF
Introduction to React Native
Angular from a Different Angle
C# Async/Await Explained
Single Page Applications: Your Browser is the OS!
Back to the ng2 Future
Let's Build an Angular App!
Angle Forward with TypeScript
Valentine with Angular js - Introduction
Introduction to React Native

What's hot (20)

PDF
Unit testing
PPTX
Building great spa’s with angular js, asp.net mvc and webapi
PPTX
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
PPTX
Latest Javascript MVC & Front End Frameworks 2017
PDF
Why Everyone else writes bad code
PPTX
Demand driven applications with om.next and react native
PDF
Angular 2 overview
PPTX
Better End-to-End Testing with Page Objects Model using Protractor
PPTX
How to build a JavaScript toolkit
PPTX
Develop a Basic REST API from Scratch Using TDD with Val Karpov
PPTX
Fast Track introduction to ASP.NET MVC
PDF
Introduction to ASP.NET MVC
PPTX
Angular4 kickstart
PDF
Frontend as a first class citizen
PDF
AngularJS + React
PPTX
Mvvm knockout vs angular
PPTX
TypeScript and Angular2 (Love at first sight)
PPTX
What's new in Visual Studio 2013 & TFS 2013
PDF
Sharing the pain using Protractor
PPT
Top java script frameworks ppt
Unit testing
Building great spa’s with angular js, asp.net mvc and webapi
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Latest Javascript MVC & Front End Frameworks 2017
Why Everyone else writes bad code
Demand driven applications with om.next and react native
Angular 2 overview
Better End-to-End Testing with Page Objects Model using Protractor
How to build a JavaScript toolkit
Develop a Basic REST API from Scratch Using TDD with Val Karpov
Fast Track introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Angular4 kickstart
Frontend as a first class citizen
AngularJS + React
Mvvm knockout vs angular
TypeScript and Angular2 (Love at first sight)
What's new in Visual Studio 2013 & TFS 2013
Sharing the pain using Protractor
Top java script frameworks ppt
Ad

Viewers also liked (8)

PPTX
Enterprise TypeScript
PPTX
Windows 8.1 Sockets
PPTX
My XML is Alive! An Intro to XAML
PPTX
The Windows Runtime and the Web
PPTX
Cross-Platform Agile DevOps with Visual Studio Team Services
PDF
Multi modularized project setup with gulp, typescript and angular.js
PDF
Angular 2 : learn TypeScript already with Angular 1
PDF
How to Become a Thought Leader in Your Niche
Enterprise TypeScript
Windows 8.1 Sockets
My XML is Alive! An Intro to XAML
The Windows Runtime and the Web
Cross-Platform Agile DevOps with Visual Studio Team Services
Multi modularized project setup with gulp, typescript and angular.js
Angular 2 : learn TypeScript already with Angular 1
How to Become a Thought Leader in Your Niche
Ad

Similar to Advanced AngularJS Tips and Tricks (20)

PDF
Advanced Tips & Tricks for using Angular JS
PDF
AngularJS in practice
PDF
III - Better angularjs
PPTX
Angular Presentation
PDF
AngularJS Curriculum-Zeolearn
PPTX
Angular js for enteprise application
PPTX
Building modular enterprise scale angular js applications
PPTX
Bhuvi ppt zerobug
PPTX
angular javascript interview questions with talent titan.pptx
PPTX
Angular Best Practices To Build Clean and Performant Web Applications
PDF
Mastering angular - Dot Net Tricks
PDF
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
PDF
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
PPTX
AngularJS Introduction (Talk given on Aug 5 2013)
PDF
Who Benefits More from the Expertise of AngularJS Developers vs. Traditional ...
PPT
Mastering Angular: A Comprehensive Guide
PDF
Building scalable applications with angular js
PPTX
Angular js workshop
PPTX
AngularJS Best Practices
PPTX
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
Advanced Tips & Tricks for using Angular JS
AngularJS in practice
III - Better angularjs
Angular Presentation
AngularJS Curriculum-Zeolearn
Angular js for enteprise application
Building modular enterprise scale angular js applications
Bhuvi ppt zerobug
angular javascript interview questions with talent titan.pptx
Angular Best Practices To Build Clean and Performant Web Applications
Mastering angular - Dot Net Tricks
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
AngularJS Introduction (Talk given on Aug 5 2013)
Who Benefits More from the Expertise of AngularJS Developers vs. Traditional ...
Mastering Angular: A Comprehensive Guide
Building scalable applications with angular js
Angular js workshop
AngularJS Best Practices
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...

Recently uploaded (20)

PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Complete React Javascript Course Syllabus.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
ai tools demonstartion for schools and inter college
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
System and Network Administration Chapter 2
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
System and Network Administraation Chapter 3
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
VVF-Customer-Presentation2025-Ver1.9.pptx
Complete React Javascript Course Syllabus.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms I-SECS-1021-03
PTS Company Brochure 2025 (1).pdf.......
ai tools demonstartion for schools and inter college
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
ManageIQ - Sprint 268 Review - Slide Deck
System and Network Administration Chapter 2
How Creative Agencies Leverage Project Management Software.pdf
Operating system designcfffgfgggggggvggggggggg
System and Network Administraation Chapter 3
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Design an Analysis of Algorithms II-SECS-1021-03
Online Work Permit System for Fast Permit Processing
ISO 45001 Occupational Health and Safety Management System
Upgrade and Innovation Strategies for SAP ERP Customers

Advanced AngularJS Tips and Tricks

  • 1. Your Cloud. Your Business. Advanced Angular Tips and Tricks Jeremy Likness Principal Architect @JeremyLikness
  • 3. TODAY’S AGENDA 1. Background Where did these tips and tricks come from? 2. Integration Tips for integrating existing JavaScript code 3. Best Practices Lessons learned in the trenches 4. Debugging Debugging Angular apps 5. Performance Writing Angular apps that scale and perform well
  • 5. BACKGROUND • Several Enterprise AngularJS Projects • Largest Project: • 80,000+ lines of TypeScript code (generated JavaScript even bigger) • 100s of controllers, services, filters, and directives • Global team of 25+ developers • 2 years of development before go-live • Exceeded client expectations for performance in most areas • How much content have you read began with “I was tinkering with…” or “I was exploring…”?
  • 6. Lessons Learned • It’s important you pick a code structure. There is no “best one” but it is important to have one. We did: /controllers ../common ../products ../customers /directives ../common ../products • Decouple from $scope as fast as you can! • Don’t rely on $scope hierarchy/inheritance • Use services for communication • Use controller as syntax • Maxim of Least Angular • Test Early, and Test Often! • For large teams, consider TypeScript
  • 9. INTEGRATION • Register and reuse third-party components with Angular’s dependency injection system • Wrap third-party components to trigger digest • Extend third-party components to be “Angular aware” • Wrap third-party controls with Angular directives • Create reusable libraries with Angular modules • Consume third-party modules with Angular
  • 12. BEST PRACTICES • $scope (addressed earlier) • Use values (or constants) where it makes sense • Wrap APIs in services and understand interceptors • Use $log and $exceptionHandler • Apply behaviors by decorating existing services with $provide • Define code using Angular’s extend • Lazy-load components with the injector when they aren’t commonly used • Use route’s “resolve” to guarantee asynchronous context
  • 15. DEBUGGING • All major browsers provide F12 “debug tools” • In Chrome, you can inspect/select an element and reference it as $0 • angular.element(x) wraps a DOM element as a node with Angular functions e.g. angular.element($0) • scope() • isolateScope() • controller() • injector() • Expand objects then navigate to source and set breakpoints/watches • Batarang
  • 18. PERFORMANCE • Batarang • Zone to instrument • Bindonce or new :: prefix • Double-list approach • ng-if vs. ng-show • Measure twice, cut once!
  • 20. Questions? Source for this deck https://github.com/JeremyLikness/AngularTipsAndTricks Running example for this deck http://jeremylikness.github.io/AngularTipsAndTricks/ Mastering AngularJS Course: fundamentals, scope, digest, filters, dependency injection, services, web services, routes, directives, testing, debugging and performance https://www.wintellectnow.com/course/detail/mastering-angularjs Jeremy Likness, Principal Architect @JeremyLikness