SlideShare a Scribd company logo
AngularJS in large
applications
AngularJS Meetup

ae nv/sa
Interleuvenlaan 27b, B-3001 Heverlee
T +32 16 39 30 60 - F +32 16 39 30 70
www.ae.be
Agenda






Introduction
Managing a large application
Communication through hypermedia
Break
Reusable components

 2
http://www.slideshare.net/AE_nv/angular-js-in-large-applications
http://ow.ly/sPVGy

#ajsugbe
 3
Introduction
 Glenn Dejaeger @glenndejaeger
 Experience: 2+ years

 Thomas Anciaux @thomaux
 Experience: 2+ years

 Pieter Herroelen @piether
 Experience: 1 year

We work for AE @AE_NV

 4
Project context







Enterprise environment
Master database system
CRUD
Spearhead
Internal project
Infrequent releases

 5
Project size

 17 developers, 4 js developers
 10k MD total
 LOC’s
 JavaScript: 7k
 Java REST layer: 11k
 Java total: 700k+

 6
PART 1

MANAGING A LARGE APPLICATION

 7
Historical Issues

APP

MODULES

FRAMEWORK

REQUIREJS

APP
.LESS

MODULES
.LESS

 8
Historical issues
 No real build
 Manual
 Monolithic

 RequireJS
 Karma

 9
Initial solutions
 Introduce Grunt
 And separate builds

 Remove dependency on RequireJS

 10
New Issues

APP

MODULES

FRAMEWORK

MODULES

BOOTSTRAP

ANGULAR

BOOTSTRAP

FRAMEWORK

FRAMEWORK

ANGULAR

ANGULAR
 11
New issues
<base href=“whatever/buildnr/”>
directive(“aDirective”, function(){
return {
...,
templateUrl: “relative/path/...”
...
}
});

 12
New issues
 Dependency management?
 Referencing HTML templates

 13
Dependency Management?
 Manual!
 Error prone
 Not feasible with a large set of dependencies

 Wrap dependencies with output
 Ugly!

 14
New Solution
 Introduce Bower
 Introduce $templateCache

 15
Bower
 Setup each project as a Bower module
 Publish versions independently
 Bower can target local or zipped folders
 Store the tagged versions anywhere you’d like

 16
$templateCache
 Angular service
 Registers templates by name
 Grunt task compiles and concatenates all HTML to
JS

 17
Conclusion
 Advantages
 Automation of build system
 Closer to pure angular (easy Karma setup etc.)
 Dependency management

 Disadvantages
 One big file per project/module
 Harder to use Chrome Dev tools

 18
QUESTIONS?

 19
PART 2

COMMUNICATION THROUGH
HYPERMEDIA
 20
Project needs
 A lot of similar functionality (CRUD)
 Hierarchical data
 Flexible UI: “A browser in a browser”
 Multiple tabs
 Links all over the place
...

 21
First approach
"municipality": {
"criteria": {
"groups": [["LABEL“,"POSTAL_CODE"]],
“label": {
"type": "TEXT_MEDIUM",
"operators": "ALPHA",
"common": true,
"mandatory": false
},
…
},
…
 22
First approach

CLIENT

DATA

SERVER

CONFIG

 23
First approach

http://www.youtube.com/watch?v=62RvRQuMVyg

 24
Richardson maturity model

http://martinfowler.com/articles/richardsonMaturityModel.html
 25
 26
Richardson maturity model

http://martinfowler.com/articles/richardsonMaturityModel.html
 27
Hypermedia

CLIENT

HYPERMEDIA

SERVER

 28
Hypermedia

CLIENT

JSON over HTTP

SERVER

 29
http://www.toddmgreen.com/wp-content/uploads/2011/12/Arthur-C-2.png
 30
Hypermedia
Content-type: application/hal+json

CLIENT

HYPERMEDIA

SERVER

 31
Hypermedia
Content-type: application/hal+json

SPEC

 32
Hypermedia
Content-type: application/hal+json

SPEC
CLIENT

SERVER

 33
Which specification?

 34
 35
HAL - Hypertext Application Language

http://stateless.co/hal_specification.html
 36
HAL

 37
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 38
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 39
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 40
EPiaAACBSwaADEtPoHTMD

<resource uri=“http://example.com/path”> ...

 41
JSON

• properties
• links
• embedded

$scope

objects

 42
JSON

• properties
• links
• embedded

$scope

functions

 43
follow() Replace content of directive with
resource behind link

Example:
<a ng-click=“links[‘children’].follow()”></a>

 44
function(method, data) Do an HTTP call
with the specified method and the specified data
in the request. Returns a promise.
Example:
$scope.links[‘save’](‘POST’, $scope.form).then(...);

 45
HAL

CLIENT

SERVER

 46
HAL

CLIENT

SERVER

LINK RELATIONS

 47
JSON

• properties
• links
• embedded

$scope

Recursive
structure

 48
JSON

$scope

HTML

• properties
• links
• embedded

• header

property

 49
JSON

$scope

<ng-include
src=“property+’.html’”>
</ng-include>

• properties
• links
• embedded

• header

HTML

property

 50
http://www.x17online.com/gisele-elephant.jpg

 51
Where is the model?

 52
http://www.x17online.com/gisele-elephant.jpg

 53
QUESTIONS?

 54
PART 2.5

BREAK

 55
PART 3

DEVELOPING REUSABLE
COMPONENTS
 56
 57
What is a component?

 58
What is a component?
 An identifiable part of a larger program or
construction
 Provides a particular function or group of related
functions
 Has its own responsibility

 59
What is a component?

COMPONENT

DIRECTIVE

 60
Grid component

 61
Grid component
directive(“grid”, function(){
return {
...
scope: {
data: ‘=‘,
columnDefs: ‘=‘,
sortable: ‘=‘,
filterable: ‘=‘
...
}
controller: ‘gridController’,
template: $templateCache.get(‘grid.html')
...
}
});
 62
Grid component
<div ng-init=“columnDefs=[
{field: ‘firstName’, title: ’firstname’},
{field: ‘lastName’, title: ’lastname’},
{field: ‘city’, title: ’city’},
{field: ‘title’, title: ’title’},
{field: ‘birthDate’, title:’birthdate’},
{field: ‘age’, title:’age’},
]”>
<div grid
data=“$scope.persons”
column-defs=“columnDefs”></div>
</div>

 63
Problem 1
 1 big controller
 Unreadable
 Unmaintainable
 No separation of concerns

 64
Solution

 Different services with their own responsibility
 Injected into controller
 Only logic, no state!

 65
Problem 2
 1 big object to configure all the columns
 Unreadable
 Static
 Error prone

 66
Solution

<div grid data=“$scope.persons”>
<div grid-column field=“firstName” title=“firstname”/>
<div grid-column field=“lastName” title=“lastname”/>
<div grid-column field=“city” title=“city”/>
<div grid-column field=“title” title=“title”/>
<div grid-column field=“birthDate” title=“birthdate”/>
<div grid-column field=“age” title=“age”/>
</div>

 67
What is a component?

COMPONENT

DIRECTIVE
DIRECTIVE
DIRECTIVE

 68
Grid component

directive(“grid”, function(){
return {
...
transclude: true
...
}
});

 69
Grid component
directive(“gridColumn”, function(){
return {
...
scope: {
field: ‘@‘,
title: ‘@‘,
hidden: ‘=‘
...
}
require: ‘^grid’,
link: function(scope, elem, attrs, gridCtrl){
...
}
...
});
 70
Communication between components
 Isolated scopes
 Don’t pollute other scopes
 No direct access to parent scope

 71
Communication between components
 Events
 Loosely coupled
 No control over listeners

 Shared services
 Tightly coupled
 Control over consumers

 72
Parting words
 Solved a number of problems
 Modularity of the build
 Interaction with a hypermedia back-end
 Modularity of the code

 Created a few new problems
 YMMV

 73
QUESTIONS?

 74
@ae_nv
linkedin.com/company/ae-nv-sa

More Related Content

PDF
Using a hypermedia API with Angular.js
PDF
AngularJS Framework
PPTX
Functional as a service TDC 2020
PDF
Android DevConference - Android Clean Architecture
PPTX
Dev sum hypemedia talk
PDF
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
PDF
Together Cheerfully to Walk with Hypermedia
PPTX
Sull’adattamento dell’individuo al cambiamento - Elisei
Using a hypermedia API with Angular.js
AngularJS Framework
Functional as a service TDC 2020
Android DevConference - Android Clean Architecture
Dev sum hypemedia talk
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
Together Cheerfully to Walk with Hypermedia
Sull’adattamento dell’individuo al cambiamento - Elisei

Viewers also liked (8)

PPTX
Hypermedia in API Design: Enterprise as an Early Adopter
PPTX
Making Sense of Hypermedia APIs – Hype or Reality?
PDF
The hypermedia api
PDF
Why should i care about hypermedia
PDF
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
PDF
Deep-dive into Microservice Outer Architecture
PDF
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
PDF
reveal.js 3.0.0
Hypermedia in API Design: Enterprise as an Early Adopter
Making Sense of Hypermedia APIs – Hype or Reality?
The hypermedia api
Why should i care about hypermedia
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Deep-dive into Microservice Outer Architecture
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
reveal.js 3.0.0
Ad

Similar to AngularJS in large applications - AE NV (20)

PPTX
AngularJS Anatomy & Directives
PDF
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
PPTX
Practical AngularJS
PDF
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
PDF
Real World AngularJS recipes: beyond TodoMVC
PDF
AngularJS in Production (CTO Forum)
PDF
Angular js gtg-27feb2013
PDF
I - Front-end Spectrum
PDF
Building scalable applications with angular js
PDF
Download full ebook of Become a ninja with Angular Ninja Squad instant downlo...
PPTX
Engineering Frontends
PDF
Quick start with AngularJS
PDF
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
PDF
Download full ebook of Become a ninja with Angular Ninja Squad instant downlo...
PDF
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
ODP
MEAN Inside out (with AngularX)
PPTX
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
PPTX
Professionalizing the Front-end
PDF
Angular js
PDF
Angular js
AngularJS Anatomy & Directives
[Ebooks PDF] download AngularJS 1st Edition Brad Green full chapters
Practical AngularJS
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC
AngularJS in Production (CTO Forum)
Angular js gtg-27feb2013
I - Front-end Spectrum
Building scalable applications with angular js
Download full ebook of Become a ninja with Angular Ninja Squad instant downlo...
Engineering Frontends
Quick start with AngularJS
Download full ebook of Angularjs Brad Green Shyam Seshadri instant download pdf
Download full ebook of Become a ninja with Angular Ninja Squad instant downlo...
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
MEAN Inside out (with AngularX)
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
Professionalizing the Front-end
Angular js
Angular js
Ad

More from AE - architects for business and ict (14)

PDF
c-quilibrium R forecasting integration
PPTX
Legal aspects of using R
PDF
AE Foyer - Value Driven Transformation
PDF
AE Foyer: Soa Integration Architecture and Api Management
PDF
AE Foyer: Information Management in the Digital Enterprise
PDF
AE Foyer: Embrace your customer get digital (handouts 18052015)
PDF
Trends in front end engineering_handouts
PDF
Embrace your customer, get digital!
PDF
Building the digital enterprise for the age of the customer (part 2)
PDF
Building the digital enterprise for the age of the customer handouts
PDF
AE foyer: From Server Virtualization to Hybrid Cloud
PDF
AE foyer on Mobile by Design 19/02/2014
PDF
AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...
PDF
Process Mining in Package Delivery (Logistics) - AE nv
c-quilibrium R forecasting integration
Legal aspects of using R
AE Foyer - Value Driven Transformation
AE Foyer: Soa Integration Architecture and Api Management
AE Foyer: Information Management in the Digital Enterprise
AE Foyer: Embrace your customer get digital (handouts 18052015)
Trends in front end engineering_handouts
Embrace your customer, get digital!
Building the digital enterprise for the age of the customer (part 2)
Building the digital enterprise for the age of the customer handouts
AE foyer: From Server Virtualization to Hybrid Cloud
AE foyer on Mobile by Design 19/02/2014
AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...
Process Mining in Package Delivery (Logistics) - AE nv

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation theory and applications.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Monthly Chronicles - July 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Encapsulation theory and applications.pdf
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”

AngularJS in large applications - AE NV