SlideShare a Scribd company logo
1 of 27
@philos_io
Performances & SEO in
AngularJS
Agenda
● Performance tips in AngularJS
● Tools for measuring performance
● SEO in AngularJS
○ Build your own SEO engine with PhantomJS
○ Using a third-tiers tool
● More Tools
● Q&A
Performances in AngularJS
Use ‘track by’ inside ng-repeat (Part 1)
1.2.X
<ul>
<li ng-repeat="book in vm.books">
<span>{{book}}</span>
</li>
</ul>
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = ["JavaScript", "Angular", "React"];
$timeout(() =>{
this.books.push('JavaScript');
}, 2000);
});
• JavaScript
• Angular
• React
JS.bin
Use ‘track by’ inside ng-repeat (Part 1)
1.2.X
<ul>
<li ng-repeat="book in vm.books">
<span>{{book}}</span>
</li>
</ul>
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = ["JavaScript", "Angular", "React"];
$timeout(() =>{
this.books.push('JavaScript');
}, 2000);
});
• JavaScript
• Angular
• React
• JavaScript
JS.bin
Use ‘track by’ inside ng-repeat (Part 2)
1.2.X
<ul>
<li ng-repeat="book in vm.books track by $index">
<span>{{book}}</span>
</li>
</ul>
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = ["JavaScript", "Angular", "React"];
$timeout(() =>{
this.books.push('JavaScript');
}, 2000);
});
• JavaScript
• Angular
• React
• JavaScript
JS.bin
Use ‘track by’ inside ng-repeat (Part 3)
1.2.X
• JavaScript
• Angular
• React
• JavaScript
<ul>
<li ng-repeat="book in vm.books track by $index">
<span>{{book.title}}</span>
</li>
</ul>
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = [
{title:"JavaScript"},
{title:"Angular"},
{title: "React"}
];
$timeout(() =>{
this.books.push({title:"JavaScript"});
}, 2000);
});
JS.bin
Use ‘track by’ inside ng-repeat (Part 4)
• Avoid using immutable data inside your collection
• Using track by will force the directive not to recreate the DOM template
• Avoid using ng-repeat with filters inline (more on this later)
1.2.X
Bind once or One time binding
1.3.X
<div ng-app="bookstore" ng-controller="BookController as vm">
<ul>
<li ng-repeat="book in vm.books track by $index">
<span>{{book.title}}</span>
</li>
</ul>
<br/>
<span>{{vm.watchers}}</span>
</div>
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = [{title:"JavaScript"},
{title:"Angular"}, {title: "React"}];
$timeout(() =>{
this.books.push({title:"JavaScript"});
this.watchers = getWatchers().length;
}, 20);
});
JS.bin
Bind once or One time binding
1.3.X
angular.module('bookstore', [])
.controller('BookController', function($timeout){
this.books = [{title:"JavaScript"},
{title:"Angular"}, {title: "React"}];
$timeout(() =>{
this.books.push({title:"JavaScript"});
this.watchers = getWatchers().length;
}, 20);
});
JS.bin
<div ng-app="bookstore" ng-controller="BookController as vm">
<ul>
<li ng-repeat="book in ::vm.books track by $index">
<span>{{::book.title}}</span>
</li>
</ul>
<br/>
<span>{{::vm.watchers}}</span>
</div>
Disable binding information
1.3.X
Docs
<div ng-app="bookstore" ng-controller="BookController as book" class="ng-scope">
<div ng-show="book.visible" class="ng-scope">
<span class="ng-binding">{{book.title}}</span>
</div>
</div>
angular.module('bookstore', [])
.config(($compileProvider) => {
$compileProvider.debugInfoEnabled(false);
});
Disable binding information
1.3.X
Docs
angular.module('bookstore', [])
.config(($compileProvider) => {
$compileProvider.debugInfoEnabled(false);
});
<div ng-app="bookstore" ng-controller="BookController as book">
<div ng-show="book.visible">
<span>{{book.title}}</span>
</div>
</div>
Use ‘useApplyAsync’ to optimize $http calls
1.3.X
Docs
Configure $http service to combine processing of multiple http responses received at
around the same time via $rootScope.$applyAsync. This can result in significant
performance improvement for bigger applications that make many HTTP requests
concurrently (common during application bootstrap).
angular.module('bookstore', [])
.config(($httpProvider) => {
$httpProvider.useApplyAsync(true);
});
Stateful vs Stateless filters
1.3.X
Docs
By default, filters are stateless. This improvement has been added into Angular 1.3 but It
can break your application in few cases.
<div ng-app="bookstore">
<input type="text" ng-model="model">
{{'start' | state}}
</div>
angular.module('bookstore', [])
.filter('state', () => {
function state(value){
console.log('run filter');
return value + ' after filtering';
}
return state;
});
Stateful vs Stateless filters
1.3.X
By default, filters are stateless. This improvement has been added into Angular 1.3 but It
can break your application in few cases.
<div ng-app="bookstore">
<input type="text" ng-model="model">
{{'start' | state}}
</div>
angular.module('bookstore', [])
.filter('state', () => {
function state(value){
console.log('run filter');
return value + ' after filtering';
}
State.$stateful = true;
return state;
});
JS.bin
Avoid using filters inside your markup 1.2.X
• Filters will run twice per $digest loop
• Use $filter inside your controller to improve performance
• Migrate to Angular 1.3 or 1.4
JS.bin
angular.module('bookstore', [])
.controller('BookController', function($scope, $timeout){
this.title = "javaScript Rocks!";
$timeout(() => {
$scope.$digest();
}, 2000);
})
.filter('upperCase', () => {
return (value) => {
console.log('inside filter');
return value[0].toUpperCase()+ value.slice(1);
};
});
<div ng-app="bookstore" ng-controller="BookController as book">
{{book.title | upperCase}}
<input type="text" ng-model="book.author"/>
<br/>
<span>{{book.author}}</span>
</div>
Use ng-if instead of ng-show
The $digest loop will run even if the component is not visible.
JS.bin
<div ng-app="bookstore" ng-controller="MainController as main">
<button ng-click="main.toggle()">Toggle</button>
<div ng-show="main.visible">
{{main.title | myFilter}}
</div>
</div>
<div ng-if="main.visible">
{{main.title | myFilter}}
</div>
Tools and more tips
• Avoid injecting components if there are not needed
• Avoid using ng-repeat where possible
• Use $templateRequest to preload your template
• Avoid using ng-repeat with filters inline
• $scope.$apply() vs $scope.$digest()? => $scope.$digest()
• JSPerf for performance measurement
• example of setting up JSPerf
• Google Chrome Dev tools (Profiling tool)
• Angular Batarang
SEO in AngularJS
What is SEO?
• Stands for Search Engine Optimization
• Search engine bots will query your website
• Since your website is an SPA, bots won’t find anything but just markup.
• Impact every JS Frameworks (Angular, Ember, Backbone, Aurelia…)
Solution?
• Build your own SEO engine
• Use a third-party solution
Use case: Prerender.io on NodeJS
Client Side
angular.module('bookstore', [])
.config(($locationProvider) => {
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(true);
}]);
Server Side : NodeJS-Express
$ npm install prerender-node --save
$ app.use(require('prerender-node'));
// Set the key from prerender.io
<meta name="fragment" content="!">
Professional options for SEO
• Prerender
• getseojs
• brombone
• Seo4ajax
To Be Continued…
Performances & SEO in AngularJS

More Related Content

What's hot

Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
Mongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsMongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsYuriy Bogomolov
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Ayes Chinmay
 
Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2Synapseindiappsdevelopment
 
Nodejs do teste de unidade ao de integração
Nodejs  do teste de unidade ao de integraçãoNodejs  do teste de unidade ao de integração
Nodejs do teste de unidade ao de integraçãoVinícius Pretto da Silva
 
Mongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsMongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsPallavi Srivastava
 
Nodejs mongoose
Nodejs mongooseNodejs mongoose
Nodejs mongooseFin Chen
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackDavid Copeland
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery BasicsKaloyan Kosev
 
Code Tops Comments
Code Tops CommentsCode Tops Comments
Code Tops CommentsMr Giap
 
えっ、なにそれこわい
えっ、なにそれこわいえっ、なにそれこわい
えっ、なにそれこわいKei Shiratsuchi
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes senseEldar Djafarov
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonMLRiza Fahmi
 

What's hot (20)

Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Mongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.jsMongoose: MongoDB object modelling for Node.js
Mongoose: MongoDB object modelling for Node.js
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
jQuery
jQueryjQuery
jQuery
 
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
MVS: An angular MVC
MVS: An angular MVCMVS: An angular MVC
MVS: An angular MVC
 
Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2
 
Nodejs do teste de unidade ao de integração
Nodejs  do teste de unidade ao de integraçãoNodejs  do teste de unidade ao de integração
Nodejs do teste de unidade ao de integração
 
Mongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsMongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node js
 
Nodejs mongoose
Nodejs mongooseNodejs mongoose
Nodejs mongoose
 
Dwr explanation
Dwr explanationDwr explanation
Dwr explanation
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power Stack
 
JavaScript and jQuery Basics
JavaScript and jQuery BasicsJavaScript and jQuery Basics
JavaScript and jQuery Basics
 
Code Tops Comments
Code Tops CommentsCode Tops Comments
Code Tops Comments
 
えっ、なにそれこわい
えっ、なにそれこわいえっ、なにそれこわい
えっ、なにそれこわい
 
React.js or why DOM finally makes sense
React.js or why DOM finally makes senseReact.js or why DOM finally makes sense
React.js or why DOM finally makes sense
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
Client Web
Client WebClient Web
Client Web
 
jQuery
jQueryjQuery
jQuery
 

Viewers also liked

Designing Creative Content: How visualising data helps us see
Designing Creative Content: How visualising data helps us seeDesigning Creative Content: How visualising data helps us see
Designing Creative Content: How visualising data helps us seeVicke Cheung
 
Meetup angular rshop
Meetup angular rshopMeetup angular rshop
Meetup angular rshopCyril Balit
 
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017Reportings SEO avec Google Data Studio - SEO Campus Paris 2017
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017Woptimo
 
SEO et ecommerce sur Magento: retour d’expérience
SEO et ecommerce sur Magento: retour d’expérienceSEO et ecommerce sur Magento: retour d’expérience
SEO et ecommerce sur Magento: retour d’expérienceAurélien Lavorel
 
SEO : comment obtenir des liens puissants grâce à un contenu décalé
SEO : comment obtenir des liens puissants grâce à un contenu décaléSEO : comment obtenir des liens puissants grâce à un contenu décalé
SEO : comment obtenir des liens puissants grâce à un contenu décaléLaurent Peyrat
 
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017Peak Ace
 
La mise en cache et ses secrets
La mise en cache et ses secretsLa mise en cache et ses secrets
La mise en cache et ses secretsAymeric Bouillat
 
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017Olivier Andrieu
 
Analyse de logs - Études de cas et best practices - SEO Campus 2017
Analyse de logs - Études de cas et best practices - SEO Campus 2017Analyse de logs - Études de cas et best practices - SEO Campus 2017
Analyse de logs - Études de cas et best practices - SEO Campus 2017iProspect France
 
HTTPS The Road To A More Secure Web / SEOCamp Paris
HTTPS The Road To A More Secure Web / SEOCamp ParisHTTPS The Road To A More Secure Web / SEOCamp Paris
HTTPS The Road To A More Secure Web / SEOCamp ParisAysun Akarsu
 
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX Intuiti
 
Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Virginie Clève - largow ☕️
 
Position 0 seocampus 2017 (Featured Snippets)
Position 0 seocampus 2017 (Featured Snippets)Position 0 seocampus 2017 (Featured Snippets)
Position 0 seocampus 2017 (Featured Snippets)DOUCET Raphael
 
Les défauts de WordPress pour le SEO
Les défauts de WordPress pour le SEOLes défauts de WordPress pour le SEO
Les défauts de WordPress pour le SEODaniel Roch - SeoMix
 
Measuring Content Marketing
Measuring Content MarketingMeasuring Content Marketing
Measuring Content MarketingDavid Iwanow
 
Organiser un projet à l’international : un Pari Fou
Organiser un projet à l’international : un Pari FouOrganiser un projet à l’international : un Pari Fou
Organiser un projet à l’international : un Pari FouOpen-linking
 
Seo camp'us 2017 utiliser google analytics comme un voyou - aristide riou
Seo camp'us 2017   utiliser google analytics comme un voyou - aristide riouSeo camp'us 2017   utiliser google analytics comme un voyou - aristide riou
Seo camp'us 2017 utiliser google analytics comme un voyou - aristide riouPrénom Nom de famille
 
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)Thomas BART
 

Viewers also liked (19)

Designing Creative Content: How visualising data helps us see
Designing Creative Content: How visualising data helps us seeDesigning Creative Content: How visualising data helps us see
Designing Creative Content: How visualising data helps us see
 
Meetup angular rshop
Meetup angular rshopMeetup angular rshop
Meetup angular rshop
 
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017Reportings SEO avec Google Data Studio - SEO Campus Paris 2017
Reportings SEO avec Google Data Studio - SEO Campus Paris 2017
 
SEO et ecommerce sur Magento: retour d’expérience
SEO et ecommerce sur Magento: retour d’expérienceSEO et ecommerce sur Magento: retour d’expérience
SEO et ecommerce sur Magento: retour d’expérience
 
SEO : comment obtenir des liens puissants grâce à un contenu décalé
SEO : comment obtenir des liens puissants grâce à un contenu décaléSEO : comment obtenir des liens puissants grâce à un contenu décalé
SEO : comment obtenir des liens puissants grâce à un contenu décalé
 
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017
Les bonnes pratiques SEO avec les frameworks javascript - SEO CAMPUS 9 mars 2017
 
La mise en cache et ses secrets
La mise en cache et ses secretsLa mise en cache et ses secrets
La mise en cache et ses secrets
 
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017
Cocon, metamots et plus si affinités sémantiques. Seo campus-03-2017
 
Analyse de logs - Études de cas et best practices - SEO Campus 2017
Analyse de logs - Études de cas et best practices - SEO Campus 2017Analyse de logs - Études de cas et best practices - SEO Campus 2017
Analyse de logs - Études de cas et best practices - SEO Campus 2017
 
HTTPS The Road To A More Secure Web / SEOCamp Paris
HTTPS The Road To A More Secure Web / SEOCamp ParisHTTPS The Road To A More Secure Web / SEOCamp Paris
HTTPS The Road To A More Secure Web / SEOCamp Paris
 
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX
Seo camp paris - A chaque enjeu, sa stratégie - Tips & REX
 
Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?Google AMP 1 an après : quel bilan, quelles perspectives ?
Google AMP 1 an après : quel bilan, quelles perspectives ?
 
Position 0 seocampus 2017 (Featured Snippets)
Position 0 seocampus 2017 (Featured Snippets)Position 0 seocampus 2017 (Featured Snippets)
Position 0 seocampus 2017 (Featured Snippets)
 
Les défauts de WordPress pour le SEO
Les défauts de WordPress pour le SEOLes défauts de WordPress pour le SEO
Les défauts de WordPress pour le SEO
 
Measuring Content Marketing
Measuring Content MarketingMeasuring Content Marketing
Measuring Content Marketing
 
Organiser un projet à l’international : un Pari Fou
Organiser un projet à l’international : un Pari FouOrganiser un projet à l’international : un Pari Fou
Organiser un projet à l’international : un Pari Fou
 
Seo camp'us 2017 utiliser google analytics comme un voyou - aristide riou
Seo camp'us 2017   utiliser google analytics comme un voyou - aristide riouSeo camp'us 2017   utiliser google analytics comme un voyou - aristide riou
Seo camp'us 2017 utiliser google analytics comme un voyou - aristide riou
 
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)
Pourquoi mes clients n'appliquent pas mes recommandations SEO (mais pas que ...)
 
Mots-clés, au delà du volume de recherche
Mots-clés, au delà du volume de rechercheMots-clés, au delà du volume de recherche
Mots-clés, au delà du volume de recherche
 

Similar to Performances & SEO in AngularJS

Angular js vs. Facebook react
Angular js vs. Facebook reactAngular js vs. Facebook react
Angular js vs. Facebook reactKeyup
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneRafael Felix da Silva
 
Sharing Data between controllers in different ways.
Sharing Data between controllers in different ways.Sharing Data between controllers in different ways.
Sharing Data between controllers in different ways.Amar Shukla
 
Different way to share data between controllers in angular js
Different way to share data between controllers in angular jsDifferent way to share data between controllers in angular js
Different way to share data between controllers in angular jscodeandyou forums
 
Client-side Rendering with AngularJS
Client-side Rendering with AngularJSClient-side Rendering with AngularJS
Client-side Rendering with AngularJSDavid Lapsley
 
A single language for backend and frontend from AngularJS to cloud with Clau...
A single language for backend and frontend  from AngularJS to cloud with Clau...A single language for backend and frontend  from AngularJS to cloud with Clau...
A single language for backend and frontend from AngularJS to cloud with Clau...Corley S.r.l.
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsMorgan Stone
 
intro to Angular js
intro to Angular jsintro to Angular js
intro to Angular jsBrian Atkins
 
Controller in AngularJS
Controller in AngularJSController in AngularJS
Controller in AngularJSBrajesh Yadav
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosLearnimtactics
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersCaldera Labs
 
A piece of sugar in your client-side development
A piece of sugar in your client-side developmentA piece of sugar in your client-side development
A piece of sugar in your client-side developmentNicolas Blanco
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSbuttyx
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJames Casey
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java DevelopersLoc Nguyen
 
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Alessandro Nadalin
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)Chris Clarke
 

Similar to Performances & SEO in AngularJS (20)

Angular js vs. Facebook react
Angular js vs. Facebook reactAngular js vs. Facebook react
Angular js vs. Facebook react
 
Aplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com BackboneAplicacoes dinamicas Rails com Backbone
Aplicacoes dinamicas Rails com Backbone
 
Sharing Data between controllers in different ways.
Sharing Data between controllers in different ways.Sharing Data between controllers in different ways.
Sharing Data between controllers in different ways.
 
Different way to share data between controllers in angular js
Different way to share data between controllers in angular jsDifferent way to share data between controllers in angular js
Different way to share data between controllers in angular js
 
Client-side Rendering with AngularJS
Client-side Rendering with AngularJSClient-side Rendering with AngularJS
Client-side Rendering with AngularJS
 
A single language for backend and frontend from AngularJS to cloud with Clau...
A single language for backend and frontend  from AngularJS to cloud with Clau...A single language for backend and frontend  from AngularJS to cloud with Clau...
A single language for backend and frontend from AngularJS to cloud with Clau...
 
Optimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page AppsOptimizing Angular Performance in Enterprise Single Page Apps
Optimizing Angular Performance in Enterprise Single Page Apps
 
intro to Angular js
intro to Angular jsintro to Angular js
intro to Angular js
 
Controller in AngularJS
Controller in AngularJSController in AngularJS
Controller in AngularJS
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle StudiosAngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
A piece of sugar in your client-side development
A piece of sugar in your client-side developmentA piece of sugar in your client-side development
A piece of sugar in your client-side development
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJS
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Jquery examples
Jquery examplesJquery examples
Jquery examples
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
 
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
Angular js is the future. maybe. @ ConFoo 2014 in Montreal (CA)
 
Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)MEAN - Notes from the field (Full-Stack Development with Javascript)
MEAN - Notes from the field (Full-Stack Development with Javascript)
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
 

Recently uploaded

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 WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 StreamsRoshan Dwivedi
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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...apidays
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Performances & SEO in AngularJS

  • 1.
  • 3. Agenda ● Performance tips in AngularJS ● Tools for measuring performance ● SEO in AngularJS ○ Build your own SEO engine with PhantomJS ○ Using a third-tiers tool ● More Tools ● Q&A
  • 4.
  • 6. Use ‘track by’ inside ng-repeat (Part 1) 1.2.X <ul> <li ng-repeat="book in vm.books"> <span>{{book}}</span> </li> </ul> angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = ["JavaScript", "Angular", "React"]; $timeout(() =>{ this.books.push('JavaScript'); }, 2000); }); • JavaScript • Angular • React JS.bin
  • 7. Use ‘track by’ inside ng-repeat (Part 1) 1.2.X <ul> <li ng-repeat="book in vm.books"> <span>{{book}}</span> </li> </ul> angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = ["JavaScript", "Angular", "React"]; $timeout(() =>{ this.books.push('JavaScript'); }, 2000); }); • JavaScript • Angular • React • JavaScript JS.bin
  • 8. Use ‘track by’ inside ng-repeat (Part 2) 1.2.X <ul> <li ng-repeat="book in vm.books track by $index"> <span>{{book}}</span> </li> </ul> angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = ["JavaScript", "Angular", "React"]; $timeout(() =>{ this.books.push('JavaScript'); }, 2000); }); • JavaScript • Angular • React • JavaScript JS.bin
  • 9. Use ‘track by’ inside ng-repeat (Part 3) 1.2.X • JavaScript • Angular • React • JavaScript <ul> <li ng-repeat="book in vm.books track by $index"> <span>{{book.title}}</span> </li> </ul> angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = [ {title:"JavaScript"}, {title:"Angular"}, {title: "React"} ]; $timeout(() =>{ this.books.push({title:"JavaScript"}); }, 2000); }); JS.bin
  • 10. Use ‘track by’ inside ng-repeat (Part 4) • Avoid using immutable data inside your collection • Using track by will force the directive not to recreate the DOM template • Avoid using ng-repeat with filters inline (more on this later) 1.2.X
  • 11. Bind once or One time binding 1.3.X <div ng-app="bookstore" ng-controller="BookController as vm"> <ul> <li ng-repeat="book in vm.books track by $index"> <span>{{book.title}}</span> </li> </ul> <br/> <span>{{vm.watchers}}</span> </div> angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = [{title:"JavaScript"}, {title:"Angular"}, {title: "React"}]; $timeout(() =>{ this.books.push({title:"JavaScript"}); this.watchers = getWatchers().length; }, 20); }); JS.bin
  • 12. Bind once or One time binding 1.3.X angular.module('bookstore', []) .controller('BookController', function($timeout){ this.books = [{title:"JavaScript"}, {title:"Angular"}, {title: "React"}]; $timeout(() =>{ this.books.push({title:"JavaScript"}); this.watchers = getWatchers().length; }, 20); }); JS.bin <div ng-app="bookstore" ng-controller="BookController as vm"> <ul> <li ng-repeat="book in ::vm.books track by $index"> <span>{{::book.title}}</span> </li> </ul> <br/> <span>{{::vm.watchers}}</span> </div>
  • 13. Disable binding information 1.3.X Docs <div ng-app="bookstore" ng-controller="BookController as book" class="ng-scope"> <div ng-show="book.visible" class="ng-scope"> <span class="ng-binding">{{book.title}}</span> </div> </div> angular.module('bookstore', []) .config(($compileProvider) => { $compileProvider.debugInfoEnabled(false); });
  • 14. Disable binding information 1.3.X Docs angular.module('bookstore', []) .config(($compileProvider) => { $compileProvider.debugInfoEnabled(false); }); <div ng-app="bookstore" ng-controller="BookController as book"> <div ng-show="book.visible"> <span>{{book.title}}</span> </div> </div>
  • 15. Use ‘useApplyAsync’ to optimize $http calls 1.3.X Docs Configure $http service to combine processing of multiple http responses received at around the same time via $rootScope.$applyAsync. This can result in significant performance improvement for bigger applications that make many HTTP requests concurrently (common during application bootstrap). angular.module('bookstore', []) .config(($httpProvider) => { $httpProvider.useApplyAsync(true); });
  • 16. Stateful vs Stateless filters 1.3.X Docs By default, filters are stateless. This improvement has been added into Angular 1.3 but It can break your application in few cases. <div ng-app="bookstore"> <input type="text" ng-model="model"> {{'start' | state}} </div> angular.module('bookstore', []) .filter('state', () => { function state(value){ console.log('run filter'); return value + ' after filtering'; } return state; });
  • 17. Stateful vs Stateless filters 1.3.X By default, filters are stateless. This improvement has been added into Angular 1.3 but It can break your application in few cases. <div ng-app="bookstore"> <input type="text" ng-model="model"> {{'start' | state}} </div> angular.module('bookstore', []) .filter('state', () => { function state(value){ console.log('run filter'); return value + ' after filtering'; } State.$stateful = true; return state; }); JS.bin
  • 18. Avoid using filters inside your markup 1.2.X • Filters will run twice per $digest loop • Use $filter inside your controller to improve performance • Migrate to Angular 1.3 or 1.4 JS.bin angular.module('bookstore', []) .controller('BookController', function($scope, $timeout){ this.title = "javaScript Rocks!"; $timeout(() => { $scope.$digest(); }, 2000); }) .filter('upperCase', () => { return (value) => { console.log('inside filter'); return value[0].toUpperCase()+ value.slice(1); }; }); <div ng-app="bookstore" ng-controller="BookController as book"> {{book.title | upperCase}} <input type="text" ng-model="book.author"/> <br/> <span>{{book.author}}</span> </div>
  • 19. Use ng-if instead of ng-show The $digest loop will run even if the component is not visible. JS.bin <div ng-app="bookstore" ng-controller="MainController as main"> <button ng-click="main.toggle()">Toggle</button> <div ng-show="main.visible"> {{main.title | myFilter}} </div> </div> <div ng-if="main.visible"> {{main.title | myFilter}} </div>
  • 20. Tools and more tips • Avoid injecting components if there are not needed • Avoid using ng-repeat where possible • Use $templateRequest to preload your template • Avoid using ng-repeat with filters inline • $scope.$apply() vs $scope.$digest()? => $scope.$digest() • JSPerf for performance measurement • example of setting up JSPerf • Google Chrome Dev tools (Profiling tool) • Angular Batarang
  • 22. What is SEO? • Stands for Search Engine Optimization • Search engine bots will query your website • Since your website is an SPA, bots won’t find anything but just markup. • Impact every JS Frameworks (Angular, Ember, Backbone, Aurelia…)
  • 23. Solution? • Build your own SEO engine • Use a third-party solution
  • 24. Use case: Prerender.io on NodeJS Client Side angular.module('bookstore', []) .config(($locationProvider) => { $locationProvider.hashPrefix('!'); $locationProvider.html5Mode(true); }]); Server Side : NodeJS-Express $ npm install prerender-node --save $ app.use(require('prerender-node')); // Set the key from prerender.io <meta name="fragment" content="!">
  • 25. Professional options for SEO • Prerender • getseojs • brombone • Seo4ajax