Impelsys
Narsingh Ispat Interview Questions and Answers
Q1. What is ng-template, ng-content and ng-container
ng-template, ng-content, and ng-container are Angular structural directives used for template rendering and content projection.
ng-template is used to define a template that can be rendered conditionally or multiple times.
ng-content is used for content projection, allowing the insertion of content from a parent component into a child component.
ng-container is a grouping element that doesn't interfere with styles or layout, often used to wrap multiple elements for structural pu...read more
Q2. Custom pipes and how to use it in html
Custom pipes in Angular are used to transform data in templates.
Custom pipes are created using the @Pipe decorator in Angular.
To use a custom pipe in HTML, you need to include it in the declarations array of the NgModule.
You can pass parameters to custom pipes in HTML using the pipe symbol (|).
Example: {{ value | customPipe:param1:param2 }}
Q3. Handle errors in fetching api call
Handle errors in fetching API calls by implementing error handling mechanisms.
Use try-catch blocks to catch errors during API calls
Implement error handling logic in the catch block to handle different types of errors
Display user-friendly error messages to inform users about the issue
Use HTTP status codes to identify the type of error (e.g. 404 for not found)
Implement retry mechanisms for temporary network issues
Q4. Explain ForkJoin and parallel execution
ForkJoin is an operator in Angular that allows for parallel execution of multiple observables.
ForkJoin combines the values from multiple observables and emits them as an array when all observables complete.
It waits for all observables to complete and then emits the combined result.
Example: forkJoin([observable1, observable2]).subscribe(result => console.log(result));
Q5. Arrow function vs Regular function
Arrow functions are concise and do not bind their own 'this' value, while regular functions have their own 'this' value and can be used as constructors.
Arrow functions have a more concise syntax compared to regular functions.
Arrow functions do not have their own 'this' value, they inherit it from the parent scope.
Regular functions have their own 'this' value, which can be useful for object-oriented programming and constructor functions.
Q6. Wildcard routes and it's syntax
Wildcard routes in Angular allow for handling unknown routes and redirecting to a default route.
Wildcard route is denoted by '**' in the route configuration.
It is typically used at the end of the route configuration to handle unknown routes.
Example: { path: '**', redirectTo: '/404' }
Q7. Explain about ES6 features
ES6 features are modern JavaScript enhancements that improve code readability and efficiency.
Arrow functions for concise syntax: const add = (a, b) => a + b;
Let and const for block-scoped variables: let x = 5; const y = 10;
Template literals for string interpolation: const name = 'John'; console.log(`Hello, ${name}!`);
Destructuring assignment for easily extracting values from arrays or objects: const { firstName, lastName } = person;
Spread syntax for merging arrays or objects:...read more
Q8. Shallow copy vs deep copy
Shallow copy only copies the references of nested objects, while deep copy creates new copies of nested objects.
Shallow copy creates a new object but does not create copies of nested objects.
Deep copy creates a new object and also creates copies of nested objects.
Shallow copy is faster and more memory efficient, but changes to nested objects affect both original and copied objects.
Deep copy is slower and consumes more memory, but changes to nested objects do not affect the or...read more
Q9. Subject vs BehaviourSubject
Subject vs BehaviourSubject in Angular
Subject is a basic observable that emits values to subscribers
BehaviourSubject is a type of Subject that stores the latest value and emits it to new subscribers
BehaviourSubject requires an initial value when created
Interview Process at Narsingh Ispat
Reviews
Interviews
Salaries
Users/Month