<aside> 💡
Points to consider before taking this
This is a Question Bank, NOT A LEARNING MATERIAL
This will only work when you have the Basics of Angular clear
If you can successfully answer these questions, you shall clear any Angular interview
If you can’t answer any question, please revisit the topic and study in detail. DO NOT MEMORISE ANSWERS
This will only be helpful if you already have sound knowledge of HTML, CSS, JS
If you are unsure of Interview questions in HTML, CSS and JS, please check my article
</aside>
/table
The app loads the index.js
the index.js
has links main.js
that has the bootstrap code
main.js
compiles from main.ts
main.ts
imports AppModule
. It has the following code → platformBrowserDynamic.bootstrapModule(AppModule)
Here AppModule
is being Bootsrapped.
AppModule
declares AppComponent
in the bootstrap
array of the @ngModule()
declaration. So whatever you write in the app component gets rendered in the bootstrap
module
A module is a set of Angular Components, Directives and Pipes that are interdependent and creates one full working unit
In Angular, the @NgModule
decorator is used to define and configure Angular modules, which are essential for organizing and structuring your application.
The @NgModule
decorator accepts a variety of properties to configure the module. Here are the key properties that can be passed to the @NgModule
decorator:
declarations
(array of components):
imports
(array of modules):
exports
(array of components, directives, and pipes):
providers
(array of providers):
bootstrap
(array of components):
AppModule
) to specify the initial component(s) to render.entryComponents
(array of components):
schemas
(array of schemas):
@NgModule({
declarations: [AppComponent, MyComponent, MyDirective, MyPipe],
imports: [CommonModule, FormsModule, HttpClientModule],
exports: [MyComponent, MyDirective, MyPipe],
providers: [MyService, { provide: APP_CONFIG, useValue: AppConfig }],
bootstrap: [AppComponent],
entryComponents: [MyDialogComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
Components are the most basic UI building block of an Angular app. An Angular app contains a tree of Angular components. Angular components are a subset of directives, always associated with a template. Unlike other directives, only one component can be instantiated for a given element in a template.
In Angular, the @Component
decorator is used to define metadata for a component. This metadata includes various properties and values that configure how the component behaves and interacts with the Angular framework. Here are some of the key values that can be passed as properties of the @Component
decorator: