File structure
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
app/app.component.* :
Root Component - AppComponent
file
ts
Defines the AppComponent
html
an HTML template
css
CSS stylesheet
spec.ts
a unit test
app/app.module.ts Defines AppModule, the root module that tells Angular how to assemble the application. Right now it declares only the AppComponent (It is the root component of what will become a tree of nested components as the application evolves.). Soon there will be more components to declare.
assets/*
A folder where you can put images and anything else to be copied wholesale when you build your application.
environments/*
This folder contains one file for each of your destination environments, each exporting simple configuration variables to use in your application. The files are replaced on-the-fly when you build your app.
index.html
The main HTML page that is served when someone visits your site. Most of the time you'll never need to edit it. The CLI automatically adds all js and css files when building your app so you never need to add any <script> or <link> tags here manually.
main.ts
The main entry point for your app. Compiles the application with the JIT compiler and bootstraps the application's root module (AppModule) to run in the browser.
You can also use the AOT compiler without changing any code by appending the --aot flag to the ng build and ng serve commands.
polyfills.ts Different browsers have different levels of support of the web standards. Polyfills help normalize those differences.
styles.css Your global styles go here.
test.ts
This is the main entry point for your unit tests. It has some custom configuration that might be unfamiliar, but it's not something you'll need to edit.
tsconfig.{app|spec}.json
TypeScript compiler configuration for the Angular app (tsconfig.app.json) and for the unit tests (tsconfig.spec.json).
Other files help you build, test, maintain, document, and deploy the app. These files go in the root folder next to src/
.e2e/
Inside e2e/ live the end-to-end tests.
protractor.conf.js End-to-end test configuration for Protractor, used when running ng e2e.
karma.conf.js Unit test configuration for the Karma test runner, used when running ng test.
.angular-cli.json Configuration for Angular CLI. In this file you can set several defaults and also configure what files are included when your project is built.
package.json npm configuration listing the third party packages your project uses. You can also add your own custom scripts here.
tsconfig.json TypeScript compiler configuration for your IDE to pick up and give you helpful tooling.
tslint.json
Linting configuration for TSLint together with Codelyzer, used when running ng lint. Linting helps keep your code style consistent.
[R]