Angular Interview question and answer
1, What is angular & advantages of angular
1, Angular is a Typescript-based free and open-source web application framework
2, Provided by Google, having long-term support
3, Cross-Platform Development.
4, Improved Speed and Performance.
5, Faster Development Process.
6, Readable and Testable Code.
7, More Lightweight Web Applications.
2, How to identify the Angular app version & Angular CLI Version?
1, ng version
2, For application version check package.json
3, What is the default port? how can we change the port?
1, default port number 4200
2, use the command ng serve –port 3000
3, Add "start": "ng serve --port 3000“ in package.json under scripts
4, Add port with value in angular.json
4, What is Interpolation?
1, This is the kind of one-way data binding, syntax {{data}}
5, What are pipes?
1, pipes are nothing but text formatter
2, basically its works like a function it will take input and return the output
6, What is property binding?
1, it’s used to set values of properties
2, syntax []
7, Difference b/w property binding & Interpolation?
1, Property binding does not convert the expression result to a string
2, property binding is suitable for bind disable, checked
8, What is module?
1, place where you can group the components, directives, pipes, and services, which are related to the application
2, It is defined using ngModule
ng generate module [module-name] –routing
9, what is directive?
1, Directives are classes that add additional behavior to elements in your Angular applications.
2, Components directives
Structural directives
Attribute directives
10, What is routing?
1, routing is an URL pattern matching
2, Used to handle the navigation from one view to the next
Routes – this is the class used to map the component & path
router-outlet – this is the place to load the active component
routerLink - this is the directive to navigate a different route
11, What is child routing?
1, Creating new Route inside the another Route
12, What is an angular route guard?
1, Angular Route Guard is an interface that can be implemented to decide if a route can be activated
2, used to implement authentication
13, what is services?
1, typescript class to have the injectable decorator
2, It can be injected into many components
3, Used to consume HTTP services also transfer the data b/w components
14, What HTTP interceptor?
1, This is also a kind of service class
2, using this one we can modify the HTTP request, can pass auth header value
15, Can we develop angular without VS Code?
1, Yes, we can develop angular using any source code editor
16, How to transfer data between components?
1, Parent to Child using @Input
2, Child to parent using @output
3, transfer bidirectional @viewchild
4, using services
17, What are forms in angular?
1, Forms are used to handle user input data
2, basically we have 2 types
* Template-driven form
* Reactive forms
18, Can we use bootstrap in angular? How?
1, Yes, we can use ng bootstrap
19, What is reactive form?
1, Reactive forms provide a model-driven approach to handling form inputs whose values change over time.
2, we can handle validations & logic from ts file itself
20, What is TDF in angular?
1, Template-driven forms use two-way data binding to update the data model in the component as changes are made in the template and vice versa.
21, Diff b/w reactive & TDF?
1, Template Driven Forms are based only on template directives, while Reactive forms are defined programmatically at the level of the component class.
21, What is two-way binding?
1, Two-way binding means that any data-related changes in view updated to modal similarly modal data change updated to all views
2, syntax is [()]
22, What is event binding?
1, used to handle the events raised by the user actions like button click, mouse movement, keystrokes, etc.
2, syntax ()
23, what is observable?
1, Observable is basically a function that can emit the data if there is any change
2, It’s provided by Rxjs
0 Comments
Post a Comment