SlideShare a Scribd company logo
1 of 22
Download to read offline
AngularJS Architecture
Michael He
Good Architecture
• Between each other has good interface design.
• Very easy to understand the function.
• You can add more to make even bigger system.
• After having rule, I never worried about the compatibility.
• Visualisable, it’s easiest way for human to understand.
Actually, Most of the
situation
• What shall I put my code? (C)
• How to understand this module? (R)
• How can I modify this part? (U)
• How can I remove this function? (D)
How to do the architecture
Look at what we need
Look at what we have
Make the decision about what we can do.
Let check we have in the
AngularJS for Architect
1. Config (Blueprint)
Define everything for the system.
2. routing system (Map)
Root
Spot
Trip
Day
Help you find the place you want to go.
3. Page (Room)
Define how the room look like,

How many things in there (Template)
How the room functioning (Controller)
4. Directive (Component)
Define how the component look like (Template)
What’s the function of it. (Controller)
5. Service (Company or GOV)
Service Name Service Content
TV service Provide TV program
Internet service Provide Internet
Gas service Provide Gas
… …
6. Filter(Decorates)
Make the room(page) looks better, hide those ugly stuff.

View Helpers.
7. Event (Phone call)
Most useful way to communicate between Components,
without dependency.
Open Internet >
< OK, Done Sir
8. Model?
• In AngularJS there is no model.
• Model in ROR, just a class mapped data in
database.
• In front end side, model will be mapping the data
from JSON to object to a Class.
• I don’t like ngResource to mapping the API path
only, when you Get or Post data you won’t have a
callback to be able to process it.
In the Real Project
/trips
/new
ItinerarySpot List
Search Box
Routing
Page(Template+Controller)
Directive
Service
Itinerary Data Sharing
Spot Searching
Itinerary Saving
Filter
Message
Message
Recenter
Add Spot to Itinerary
Talk
ItinerarySpot List
Search Box
Page(Template+Controller)
Sharing Data Between them
• Send Message by event.
• Use Service, it’s Singleton so you need to clean
the data manually. (Tip: scope $destroy)
File Structure
• Principle: You can find your file very fast.
• /trips/new

/app/modules/trips/controllers/new.js.coffee
• Spot list panel

/app/modules/trips/directives/spot_list_panel.js.coffee
• Trip Manager (manager we say it used for data sharing)

/app/services/trip_manager.js.coffee
• UI-Router Config

/app/configs/routes.js.coffee
We are not using
• Angular modularization

(It’s good way to force developer to think about the module
independent. But it’s much more complicated many
situations. For small or middle project no need to use it.)
• require.js

(we use assets pipeline to put all file in to one, super
simple, no need to manage the complicated loading
dependency.)
• Pure Javascript

(We use coffeescript to avoid many javascript traps, also
much simpler and smaller.)
More?
Please go to http://blog.memoryforcer.com

More Related Content

What's hot

What's hot (20)

Angular js
Angular jsAngular js
Angular js
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
 
5 angularjs features
5 angularjs features5 angularjs features
5 angularjs features
 
Front end development with Angular JS
Front end development with Angular JSFront end development with Angular JS
Front end development with Angular JS
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 
Angular js
Angular jsAngular js
Angular js
 
Why angular js Framework
Why angular js Framework Why angular js Framework
Why angular js Framework
 
Getting Started with Angular JS
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Step by Step - AngularJS
Step by Step - AngularJSStep by Step - AngularJS
Step by Step - AngularJS
 
Angular js 1.3 basic tutorial
Angular js 1.3 basic tutorialAngular js 1.3 basic tutorial
Angular js 1.3 basic tutorial
 
Angular js
Angular jsAngular js
Angular js
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Angular js PPT
Angular js PPTAngular js PPT
Angular js PPT
 
AngularJs (1.x) Presentation
AngularJs (1.x) PresentationAngularJs (1.x) Presentation
AngularJs (1.x) Presentation
 
Angular JS
Angular JSAngular JS
Angular JS
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
AngularJS: an introduction
AngularJS: an introductionAngularJS: an introduction
AngularJS: an introduction
 

Similar to Angularjs architecture

European Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure FunctionsEuropean Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
Sébastien Levert
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
Sébastien Levert
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
Andrew Lovett-Barron
 

Similar to Angularjs architecture (20)

Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)
 
SQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 QuestionsSQL to NoSQL: Top 6 Questions
SQL to NoSQL: Top 6 Questions
 
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure FunctionsEuropean Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Plan your Chunks! Win the Future with Information Architecture NOW
Plan your Chunks! Win the Future with Information Architecture NOWPlan your Chunks! Win the Future with Information Architecture NOW
Plan your Chunks! Win the Future with Information Architecture NOW
 
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for Beginners
 
Node.js
Node.jsNode.js
Node.js
 
October 2014 - USG Rock Eagle - Drupal 101
October 2014 - USG Rock Eagle - Drupal 101October 2014 - USG Rock Eagle - Drupal 101
October 2014 - USG Rock Eagle - Drupal 101
 
Graph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft EcosystemGraph Databases in the Microsoft Ecosystem
Graph Databases in the Microsoft Ecosystem
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 
Image Recognition for RAX Studio Citrix Automation
Image Recognition for RAX Studio Citrix AutomationImage Recognition for RAX Studio Citrix Automation
Image Recognition for RAX Studio Citrix Automation
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 

Angularjs architecture

  • 2. Good Architecture • Between each other has good interface design. • Very easy to understand the function. • You can add more to make even bigger system. • After having rule, I never worried about the compatibility. • Visualisable, it’s easiest way for human to understand.
  • 3. Actually, Most of the situation • What shall I put my code? (C) • How to understand this module? (R) • How can I modify this part? (U) • How can I remove this function? (D)
  • 4. How to do the architecture
  • 5. Look at what we need
  • 6. Look at what we have
  • 7. Make the decision about what we can do.
  • 8. Let check we have in the AngularJS for Architect
  • 9. 1. Config (Blueprint) Define everything for the system.
  • 10. 2. routing system (Map) Root Spot Trip Day Help you find the place you want to go.
  • 11. 3. Page (Room) Define how the room look like,
 How many things in there (Template) How the room functioning (Controller)
  • 12. 4. Directive (Component) Define how the component look like (Template) What’s the function of it. (Controller)
  • 13. 5. Service (Company or GOV) Service Name Service Content TV service Provide TV program Internet service Provide Internet Gas service Provide Gas … …
  • 14. 6. Filter(Decorates) Make the room(page) looks better, hide those ugly stuff.
 View Helpers.
  • 15. 7. Event (Phone call) Most useful way to communicate between Components, without dependency. Open Internet > < OK, Done Sir
  • 16. 8. Model? • In AngularJS there is no model. • Model in ROR, just a class mapped data in database. • In front end side, model will be mapping the data from JSON to object to a Class. • I don’t like ngResource to mapping the API path only, when you Get or Post data you won’t have a callback to be able to process it.
  • 17. In the Real Project
  • 18. /trips /new ItinerarySpot List Search Box Routing Page(Template+Controller) Directive Service Itinerary Data Sharing Spot Searching Itinerary Saving Filter Message Message Recenter Add Spot to Itinerary Talk
  • 19. ItinerarySpot List Search Box Page(Template+Controller) Sharing Data Between them • Send Message by event. • Use Service, it’s Singleton so you need to clean the data manually. (Tip: scope $destroy)
  • 20. File Structure • Principle: You can find your file very fast. • /trips/new
 /app/modules/trips/controllers/new.js.coffee • Spot list panel
 /app/modules/trips/directives/spot_list_panel.js.coffee • Trip Manager (manager we say it used for data sharing)
 /app/services/trip_manager.js.coffee • UI-Router Config
 /app/configs/routes.js.coffee
  • 21. We are not using • Angular modularization
 (It’s good way to force developer to think about the module independent. But it’s much more complicated many situations. For small or middle project no need to use it.) • require.js
 (we use assets pipeline to put all file in to one, super simple, no need to manage the complicated loading dependency.) • Pure Javascript
 (We use coffeescript to avoid many javascript traps, also much simpler and smaller.)
  • 22. More? Please go to http://blog.memoryforcer.com