Loading

Quipoin Menu

Learn • Practice • Grow

angular / Angular File Ecosystem
interview

Q1. What are the main files in an Angular project?
An Angular project created with CLI has several key files: src/index.html (main HTML page), src/main.ts (application entry point), src/app/app.module.ts (root module), src/app/app.component.ts (root component), angular.json (CLI configuration), package.json (npm dependencies), tsconfig.json (TypeScript configuration), and environment files for environment-specific settings.

Q2. What is the role of main.ts?
The main.ts file is the entry point of the Angular application. It bootstraps the root module (AppModule) by calling platformBrowserDynamic().bootstrapModule(AppModule). This starts the Angular application, loading the root module and its components. It also configures the environment and can enable production mode.

Q3. What is the purpose of index.html?
The index.html is the main HTML page served to the browser. It typically contains a root element (e.g., ) where the Angular application will be rendered. It also includes references to global styles and scripts. During build, Angular CLI automatically adds references to the generated JavaScript and CSS bundles.

Q4. What is the purpose of the app.module.ts file?
The app.module.ts defines the root module (AppModule) of the Angular application. A module decorates a class with @NgModule and declares which components, directives, pipes belong to it, imports other modules, and provides services. The root module bootstraps the main component. It organizes the application into cohesive blocks.

Q5. What are environment files in Angular?
Environment files (environment.ts and environment.prod.ts) store configuration values that differ between development and production. For example, API base URLs, logging flags, or feature toggles. The Angular CLI replaces environment.ts with the appropriate file based on the build configuration (--prod uses environment.prod.ts).