Angular Application Structure

Angular Application Structure

An Angular project is the foundation for both quick experiments and enterprise solutions.

The first file you should check out is README.md. It has some basic information on how to use CLI commands. Whenever you want to know more about how Angular CLI works make sure to visit the Angular CLI repository and Wiki.

Some of the generated files might be unfamiliar to you.

The src folder

Your app lives in the src folder. All Angular components, templates, styles, images, and anything else your app needs go here. Any files outside of this folder are meant to support building your app.

Let’s get to best practices and what you should be doing to build scalable and maintainable AngularJS apps that your coworkers will love you for. An ideal AngularJS app structure should be modularized into very specific functions. We also want to take advantage of the wonderful AngularJS directives to further compartmentalize our apps. Take a look at a sample directory structure below:

app/
—– shared/ // acts as reusable components or partials of our site
———- sidebar/
————— sidebarDirective.js
————— sidebarView.html
———- article/
————— articleDirective.js
————— articleView.html
—– components/ // each component is treated as a mini Angular app
———- home/
————— homeController.js
————— homeService.js
————— homeView.html
———- blog/
————— blogController.js
————— blogService.js
————— blogView.html
—– app.module.js
—– app.routes.js
assets/
—– img/ // Images and icons for your app
—– css/ // All styles and style related files (SCSS or LESS files)
—– js/ // JavaScript files written for your app that are not for angular
—– libs/ // Third-party libraries such as jQuery, Moment, Underscore, etc.
index.html

This directory structure is much harder to read and understand from the get go. A newcomer to Angular may be completely turned off by this complex approach, and that is why you see tutorials and examples in Angular

 

IT Professionals, Web Developers, Web Programmers, IT students can Apply for the certification course to move ahead in their careers.

Angular 4 Tutorial IndexBack to Angular 4 Tutorial Main Page

Sample Angular Application
TypeScript

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?