Welcome to the free & complete Angular Tutorial.
In this lesson, we are going to discuss about Angular workspace & project file structure.
In the previous article, we quickly created Hello World application using Angular CLI.
Take a moment and have a quick glance at folder structure of Hello World application you created and come back. You haven’t created one, no worries, you can still proceed with this post.
We will dissect each and every file under Angular project in this lesson. If you have any questions please ask me in the comment section out there in the bottom of this post, I will answer for sure.
Let’s get started.
Here are the workspace files you will find under Angular project:
- .editorconfig – Configuration for IDE / code editors.
- .gitignore – Specifies files that Git should ignore.
- angular.json – Default CLI configuration file common for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as TSLint, Karma, and Protractor.
- node_modules – Provides npm packages to the whole workspace.
- package.json – npm configuration file that has list of packages dependencies that are available to all projects in the workspace.
- package-lock.json – Provides version information for all packages installed into node_modules by the npm client.
- tsconfig.json – Default TypeScript configuration for apps in the workspace, including TypeScript and Angular template compiler options.
- tslint.json – Default TSLint configuration for apps in the workspace.
- README.md – Project documentation for GIT projects.
App project files
- app/ – Contains the module, component and service files. Click here to know more about App folder.
- assets/ – Contains image files and other asset files that are to be bundled with your application at the time of building the application.
- environments/ – Contains build configuration options for particular target environments. By default there is an unnamed standard development environment and a production (“prod”) environment.
- browserslist – Configures sharing of target browsers and Node.js versions among various front-end tools.
- favicon.ico – An icon that is visible in bookmark bar
- main.ts – The main entry point for the app. Compiles the application with the JIT compiler and bootstraps the application’s root module (AppModule) to run in the browser.
- polyfills.ts – Provides polyfill scripts for browser support mainly for IE & Edge.
- styles.css – Main CSS file for entire application
- test.ts – The main entry point for your unit tests.
- tsconfig.app.json – Inherits from the workspace-wide tsconfig.json file.
- tsconfig.spec.json – Inherits from the workspace-wide tsconfig.json file.
- tslint.json – Inherits from the workspace-wide tslint.json file.
App source folder
- app/app.component.ts – Defines the logic for the app’s root component, named AppComponent (the default component created by CLI). The view associated with this root component becomes the root of the view hierarchy as you add components and services to your app.
- app/app.component.html – Defines the HTML template associated with the root AppComponent.
- app/app.component.css – Defines the base CSS stylesheet just for the root AppComponent.
- app/app.component.spec.ts – Defines a unit test for the root AppComponent.
- app/app.module.ts – Defines the root module, named AppModule, that tells Angular how to assemble the application. Initially declares only the AppComponent. As you add more components to the app, they must be declared here. Even services need to be declared here.
- assets/* – Contains image files and other asset files that are to be bundled with your application at the time of building the application.