SlideShare a Scribd company logo
Angular Coding Standards.
The purpose of the Angular coding standards document istocreate abaseline for collaboration andreview within various aspects of the HTML project
andthis document will helpdevelopers tounderstand how he/she canwrite better code, sothat other developers canbetter understand it.
Do’s
Rework the defaultdirectory structure:
It’s helpful toknow that you canrestructure Angular’s default
directories. The default directories you’re given will depend on the
type ofsoftware you’re writing.
Keep presentation logic out of controllers:
InanMVC architecture, every module isseparated intoeither the
model, viewor controller. The view iswhere your presentation logic is
coded. The presentation isanything todowith the DOM. Ifyou need
tochange avalue inanyHTML element, youshould only usethe
presentation layer todoit.
.
Use dependency injection:
Dependency injection isawaytodecouple parts ofyour application
from the mainlogic.
Use angularjs-specific testing tools:
There are options when it comes totesting, but be sure tochoose
carefully. Chrome comes with itsown developer tools, and many
developers useFirefox plugins totestJavaScript code. But AngularJS is
ahighly modified formof JavaScript. Because Google developed
AngularJS, the most common (andprobably the safest) tool touse is
the Chrome extension ng-inspector.
Keep controllers simple:
Controllers are meant todefine your scope variables and encapsulate
view relatedlogic. Please don’t use controllers for DOM interactions
or data manipulation.
Business logic belongs to models:
Data processing should always be kept inmodels, that way they can
easilybe shared between controllers andother services. Plus it'seasier
towrite unit test for them.
Use codelyzer tool:
Codelyzer helps us suggest the best practices during writing angular
code.
Use lazy load:
Uselazyloading onsubcomponents andwhere ever possible.
Use AoT:
Usageof AoT (aheadof time)compilation isagreat steptowards
performance gains atruntime. Italsoreduces your bundle byabout
30kb (gzipped) which isaLOT of improvement. Angular 4.0+ brings
about 30% improvement inappbundles due tohow itgenerates the
AoT code.
Keep Components Focused:
Reusing components withseveral views isbrittle andgoodend-to-
end(e2e) test coverage isrequired toensure stability across large
applications.
Small Functions:
Small functions helpavoid hidden bugs that come withlarge functions
that share variables with external scope, create unwanted closures, or
unwanted coupling with dependencies
Defer Logic to Services:
Logic maybe reused bymultiple components when placedwithin a
service andexposed via afunction.
File Naming Guidelines:
Namingconventions helpprovide aconsistent way tofindcontent at
aglance. Consistency within the project isvital.
Modularity:
Modular applications makeit easytoplug andgoasthey allow the
development teamstobuild vertical slices ofthe applications androll
out incrementally. This meanswe can plug innew features aswe
develop them.
Don’ts
● Avoid NamingCollisions.
● Don’t import the full package.
● Don’t dependmuchonjQuery plugin

More Related Content

What's hot

Facial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET CoreFacial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET Core
Marvin Heng
 
Automation Software Testing with Selenium & Python
Automation Software Testing with Selenium & PythonAutomation Software Testing with Selenium & Python
Automation Software Testing with Selenium & Python
Amar Verma
 
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheimapidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
apidays
 
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
DicodingEvent
 
Top 5 Javascript Frameworks for Web and Mobile App Development
Top 5 Javascript Frameworks for Web and Mobile App DevelopmentTop 5 Javascript Frameworks for Web and Mobile App Development
Top 5 Javascript Frameworks for Web and Mobile App Development
Ajeet Singh
 
Presentatie EPLAN
Presentatie EPLANPresentatie EPLAN
Presentatie EPLAN
switchingonthefuture
 
Openflexo's infrastructure - exhibitor - @models2012
Openflexo's infrastructure - exhibitor - @models2012Openflexo's infrastructure - exhibitor - @models2012
Openflexo's infrastructure - exhibitor - @models2012
Openflexo
 

What's hot (7)

Facial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET CoreFacial Analysis with Angular Web App & ASP.NET Core
Facial Analysis with Angular Web App & ASP.NET Core
 
Automation Software Testing with Selenium & Python
Automation Software Testing with Selenium & PythonAutomation Software Testing with Selenium & Python
Automation Software Testing with Selenium & Python
 
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheimapidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
apidays LIVE Paris - GraphQL: the AppSec perspective by Vladimir de Turckheim
 
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
 
Top 5 Javascript Frameworks for Web and Mobile App Development
Top 5 Javascript Frameworks for Web and Mobile App DevelopmentTop 5 Javascript Frameworks for Web and Mobile App Development
Top 5 Javascript Frameworks for Web and Mobile App Development
 
Presentatie EPLAN
Presentatie EPLANPresentatie EPLAN
Presentatie EPLAN
 
Openflexo's infrastructure - exhibitor - @models2012
Openflexo's infrastructure - exhibitor - @models2012Openflexo's infrastructure - exhibitor - @models2012
Openflexo's infrastructure - exhibitor - @models2012
 

Similar to Angular best practices

Angular js
Angular jsAngular js
Angular js
ymtech
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
Chirag Parmar
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
rupeshchanchal
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Angular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web ApplicationsAngular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web Applications
Albiorix Technology
 
5 benefits of angular js
5 benefits of angular js5 benefits of angular js
5 benefits of angular js
OnGraph Technologies Pvt. Ltd.
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
Albiorix Technology
 
Angular js up & running
Angular js up & runningAngular js up & running
Angular js up & running
Junaid Baloch
 
What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?
Albiorix Technology
 
Android app development SEO Expert Bangladesh LTD.pdf
Android app development  SEO Expert Bangladesh LTD.pdfAndroid app development  SEO Expert Bangladesh LTD.pdf
Android app development SEO Expert Bangladesh LTD.pdf
Tasnim Jahan
 
Android app development SEO Expert Bangladesh LTD.pdf
Android app development  SEO Expert Bangladesh LTD.pdfAndroid app development  SEO Expert Bangladesh LTD.pdf
Android app development SEO Expert Bangladesh LTD.pdf
Tasnim Jahan
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
sarah david
 
A perfect choice for web apps
A perfect choice for web apps A perfect choice for web apps
A perfect choice for web apps
adhyathakkar10
 
MVC 3.0 KU Day 1 v 1.1
MVC 3.0 KU Day 1 v 1.1MVC 3.0 KU Day 1 v 1.1
MVC 3.0 KU Day 1 v 1.1
Lek Pongpatimet
 
Technical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdfTechnical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdf
SakthivelPeriyasamy6
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
sarah david
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
sarah david
 
Itroducing Angular JS
Itroducing Angular JSItroducing Angular JS
Itroducing Angular JS
Carlos Emanuel Mathiasen
 
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdf
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdfLearn About AngularJS's Numerous Benefits for a Web Development Company .pdf
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdf
Flexsin
 
Introduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setupIntroduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setup
Ansley Rodrigues
 

Similar to Angular best practices (20)

Angular js
Angular jsAngular js
Angular js
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Angular 9
Angular 9 Angular 9
Angular 9
 
Angular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web ApplicationsAngular Best Practices To Build Clean and Performant Web Applications
Angular Best Practices To Build Clean and Performant Web Applications
 
5 benefits of angular js
5 benefits of angular js5 benefits of angular js
5 benefits of angular js
 
How Does Angular Work?
How Does Angular Work?How Does Angular Work?
How Does Angular Work?
 
Angular js up & running
Angular js up & runningAngular js up & running
Angular js up & running
 
What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?What are the key distinctions between Angular and AngularJS?
What are the key distinctions between Angular and AngularJS?
 
Android app development SEO Expert Bangladesh LTD.pdf
Android app development  SEO Expert Bangladesh LTD.pdfAndroid app development  SEO Expert Bangladesh LTD.pdf
Android app development SEO Expert Bangladesh LTD.pdf
 
Android app development SEO Expert Bangladesh LTD.pdf
Android app development  SEO Expert Bangladesh LTD.pdfAndroid app development  SEO Expert Bangladesh LTD.pdf
Android app development SEO Expert Bangladesh LTD.pdf
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
A perfect choice for web apps
A perfect choice for web apps A perfect choice for web apps
A perfect choice for web apps
 
MVC 3.0 KU Day 1 v 1.1
MVC 3.0 KU Day 1 v 1.1MVC 3.0 KU Day 1 v 1.1
MVC 3.0 KU Day 1 v 1.1
 
Technical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdfTechnical-design-for-Angular-apps.pdf
Technical-design-for-Angular-apps.pdf
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptxangularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
angularjs_vs_angular_the_key_differences_between_javascript_and_typescript.pptx
 
Itroducing Angular JS
Itroducing Angular JSItroducing Angular JS
Itroducing Angular JS
 
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdf
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdfLearn About AngularJS's Numerous Benefits for a Web Development Company .pdf
Learn About AngularJS's Numerous Benefits for a Web Development Company .pdf
 
Introduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setupIntroduction to angular | Concepts and Environment setup
Introduction to angular | Concepts and Environment setup
 

More from Allanki Srinivas

Static site best practices
Static site best practicesStatic site best practices
Static site best practices
Allanki Srinivas
 
Wordpress best practices
Wordpress best practicesWordpress best practices
Wordpress best practices
Allanki Srinivas
 
Ionic best practices
Ionic best practicesIonic best practices
Ionic best practices
Allanki Srinivas
 
Ionic best practices
Ionic best practicesIonic best practices
Ionic best practices
Allanki Srinivas
 
Web accessibility
Web accessibilityWeb accessibility
Web accessibility
Allanki Srinivas
 
Melukolupu
MelukolupuMelukolupu
Melukolupu
Allanki Srinivas
 

More from Allanki Srinivas (6)

Static site best practices
Static site best practicesStatic site best practices
Static site best practices
 
Wordpress best practices
Wordpress best practicesWordpress best practices
Wordpress best practices
 
Ionic best practices
Ionic best practicesIonic best practices
Ionic best practices
 
Ionic best practices
Ionic best practicesIonic best practices
Ionic best practices
 
Web accessibility
Web accessibilityWeb accessibility
Web accessibility
 
Melukolupu
MelukolupuMelukolupu
Melukolupu
 

Recently uploaded

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 

Recently uploaded (20)

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 

Angular best practices

  • 1. Angular Coding Standards. The purpose of the Angular coding standards document istocreate abaseline for collaboration andreview within various aspects of the HTML project andthis document will helpdevelopers tounderstand how he/she canwrite better code, sothat other developers canbetter understand it. Do’s Rework the defaultdirectory structure: It’s helpful toknow that you canrestructure Angular’s default directories. The default directories you’re given will depend on the type ofsoftware you’re writing. Keep presentation logic out of controllers: InanMVC architecture, every module isseparated intoeither the model, viewor controller. The view iswhere your presentation logic is coded. The presentation isanything todowith the DOM. Ifyou need tochange avalue inanyHTML element, youshould only usethe presentation layer todoit. . Use dependency injection: Dependency injection isawaytodecouple parts ofyour application from the mainlogic. Use angularjs-specific testing tools: There are options when it comes totesting, but be sure tochoose carefully. Chrome comes with itsown developer tools, and many developers useFirefox plugins totestJavaScript code. But AngularJS is ahighly modified formof JavaScript. Because Google developed AngularJS, the most common (andprobably the safest) tool touse is the Chrome extension ng-inspector. Keep controllers simple: Controllers are meant todefine your scope variables and encapsulate view relatedlogic. Please don’t use controllers for DOM interactions or data manipulation. Business logic belongs to models: Data processing should always be kept inmodels, that way they can easilybe shared between controllers andother services. Plus it'seasier towrite unit test for them. Use codelyzer tool: Codelyzer helps us suggest the best practices during writing angular code. Use lazy load: Uselazyloading onsubcomponents andwhere ever possible. Use AoT: Usageof AoT (aheadof time)compilation isagreat steptowards performance gains atruntime. Italsoreduces your bundle byabout 30kb (gzipped) which isaLOT of improvement. Angular 4.0+ brings about 30% improvement inappbundles due tohow itgenerates the AoT code. Keep Components Focused: Reusing components withseveral views isbrittle andgoodend-to- end(e2e) test coverage isrequired toensure stability across large applications. Small Functions: Small functions helpavoid hidden bugs that come withlarge functions that share variables with external scope, create unwanted closures, or unwanted coupling with dependencies Defer Logic to Services: Logic maybe reused bymultiple components when placedwithin a service andexposed via afunction. File Naming Guidelines: Namingconventions helpprovide aconsistent way tofindcontent at aglance. Consistency within the project isvital. Modularity: Modular applications makeit easytoplug andgoasthey allow the development teamstobuild vertical slices ofthe applications androll out incrementally. This meanswe can plug innew features aswe develop them. Don’ts ● Avoid NamingCollisions. ● Don’t import the full package. ● Don’t dependmuchonjQuery plugin