Sl No | Questions | Keyword Answer | Example |
1 | What does "npm install -g" mean? | To install npm package global level | |
2 | What is Angular CLI | It is command line interface which helps to get basic setup of angular project | npm
install -g @angular/cli ng new project-name cd project-name ng serve |
3 | How to create app using Angular CLI? | ng
new project-name cd project-name code . (to open project in Visual studio code editor) ng serve |
|
4 | Differentiate between ng serve and ng builld? | ng
serve - Is use to run application in In-memory (inside RAM) taking whole
application compling hosted in http://localhost:4200/ ng build - To |
|
5 | What do folder "src", "dist" and "e2e" contain? | Src
- (source folder) All source code dist - (distribution folder) All build js will be saved after running ng build command e2e - (end to end testing folder) For testing purpose |
|
6 | what is importance of angular.json file in Angular cli? | Workspace is a directory which is generated via Angular CLI | |
7 | What are components and modules in Angular | Components
- Class file which will interact with UI i.e., html files Modules - Which is used to group components, directives, pipes and services |
|
8 | What is use of TemplateURL | which connects components and html page | |
9 | Explain modules | Which is used to group components, directives, pipes and services | @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) |
10 | What is use of Bootstrap in Modules | Out of many components, Bootstrap helps for starting the execution | |
11 | Which file defines the start module of angular project | Main.ts
files PlatformBrowserDynamic method from @angular/PlatformBrowserDynamic library |
platformBrowserDynamic().bootstrapModule(MainModule) |
12 | What is Import in module | To
import angular library to NgModule import statement on top is used by typescript import { FormsModule } from '@angular/forms'; |
For import statement import { FormsModule } from '@angular/forms'; Import in @NgModule imports: [ BrowserModule, FormsModule ] |
13 | What is Provider in module | Will include in services created | |
14 | What will happen if polyfills are not used | make
our Angular application compatible for different browsers. Angular code in ES6(New Features: Overview and Comparison) and is not compatible with IE or firefox and needs some environment setups before being able to be viewed or used in these browsers. |
Polyfills.ts was provided by angular to help you do away with need to specifically setup everything. |
15 | What is need of Webpack | Webpack is a module bundler, but you can also use it running tasks as well | |
16 | How to use *ngFor Loop directive | NgFor is a directive that iterates over collection of data | |
17 | Explain ^ and ~ for version resolution | ^ Latest minor version ~ Latest revision version |
6.1.0 6 is major version 1 is for minor version 0 is for revision version |
18 | Can we have Angular UI without a component | No | |
19 | What is routing Collection | Routing collection is nothing but where we specify URL and component which is loaded | |
20 | Explaing the importance of [routerLink] in href element | To naviage between routes | <a [router-link]="['home']">Home</a> |
21 | What is importance of router-outlet element in routing | router-outlet is directive which tell router to render the content in view | <router-outlet></router-outlet> |
22 | Explain importance of loadChildren | To achieve lazy loading routing | |
23 | How is URL structured for loadChildren | ../Customer/CustomerApp.CustomerModule#CustomerModule Customer - folder or path CustomerApp.CustomerModule - Filename or path #CustomerModule - After # Class to be loaded |
|
24 | Explain importance for forRoot and forChild | forRoot
- For eager loading forChild - For lazy loading |
|
25 | What the importance of Dirty Flag, pristine, touched, untouched, valid, invalid | Dirty
flag - indicates user has changed values Pristine - opposite of dirty flag Touched - indicates field is touched by user Untouched - Opposite of touched Valid - Checks whether all validation have passed Invalid - opposite of valid |
|
26 | When do we need to provide standalone option | Control which is inside FormGroup without validation is to be provide standalone option | [ngModelOptions] = "{ standalone : true }" |
27 | What is benefit of DI | dependency injection is a technique whereby one object supplies the dependencies to another object | |
28 | What are two kinds of DI | Centralized
DI Conditional DI |
|
29 | Explain importance of injector | Injector is used to achieve conditional based DI. | |
30 | Define reusable user controls | Reusable code snipnet of UI which we can plug into any HTML | |
31 | Explain inputs, output and event emittes | @Input is a decorator to mark an input
property and @Output is a decorator to mark an output property. EventEmitter is really an Angular abstraction, and should be used pretty much only for emitting custom Events in components |
|
32 | which
of the below naming convention is good for a custom user control myTextBox my-texbox |
my-textbox - because it should not get confict with html tag which might release in future | |
33 | Which
notatin will you use when data flows from user control to main UI [] () |
[] | |
34 | How to use HTTP component | To call to server via restful servcie | |
35 | Why DTO is a better way of transferring data | To avoid circular dependency error | |
36 | In new project should we use HTTP or HTTP client | HTTP
client HTTP is deprecated from Angular 7 |
|
37 | What is importance of DI in using HTTP component | As we want to migrate from Angular 6 to 7. We don’t need to change too much of code | |
38 | What are interceptors in httpclient | To set security key in http header call | |
39 | how to create fake server | json-server | |
40 | explain the importance of integrated terminal in VS code? | We
can create more terminals like for run fake server via json-server which use port 3000 and other we can use for ng serve to run angular application port 4200 |
npm
install -g json-server json-server --watch db.json |
Wednesday, 24 July 2019
Interview question one line on Angular
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment