Intermediate Level Angular Interview Questions
3 min readMar 1, 2021
Components
- What is the difference between directive and the component?
- Difference between ngOnChanges and ngDoCheck?
- How to send data from child to parent?
- What is Change detection and type of change detection?
- What is view encapsulation?
- What is Shadow dom?
- What is EventEmitter? Can we use it in service if yes then how to tell the use case?
Templates
- Can we put maths expressions in interpolation?
- What is event binding?
- What is the difference between impure and pure pipe?
- Can we apply pipe in ngFor ? How to get the length of the filtered result?
- Make a groupby pipe?
- What is property binding?
- What is attribute binding?
- What is a template reference variable? What are all the use cases?
Directives
- What are types of directives available ?
- Why * (start) asterisk before ngFor ?
- Can we use ngFor and ngIf on the same element?
- Write syntax for custom directive ?
- Difference between Attribute and structure directive?
- What is ng template , ng container?
- Where to use ngSwitch syntax ?
Dependency Injection
- What is Injectable?
- What is provided in types (root etc)?
- Difference between public and private service injection?
- What is a provider?
- How to create multiple instances of a service (sandboxing)?
Routing & Navigation
- What is codespliting?
- What is lazy loading ?
- How to get current route information?
- What is a wildcard route?
- How set display a 404 page?
- How to do nesting routing?
- What is the relative path?
- Difference between query param and parm?
- What is a route guard? Use of canactivate?
- Difference location strategies ?
- What activate route and snapshot route?
- Difference between for root and for child ?
Forms
- Difference between Reactive form and template driven form?
- What is a control value accessor?
- What is the use of a formArray ?
- What is the use of formGroup?
- In which form reactive or template driven form model is implicit?
- How does data flow in both forms?
- What is mutability of data model?
- What is form validation? How to define custom validation on both forms?
- How to put validation error in template driven form?
- Difference between sync and async validator function?
- What is abstract control?
- How to put a validation class on the form element?
- Difference between set and patch value?
HTTP Client
- What is an http interceptor?
- What are different options in request ?
- What are different response type?
- How to cancel any request?
- How to handle multiple request hit one after another any once can come first or second etc?
- What is JSONP?
- How to read non json data?
- How to handle errors?
- How to retry a failed request?
Testing
- What is code coverage? How to check it?
- How to test services with multiple dependencies ?
- What is spy object?
- What is testbed ?
- What is a component fixture?
- How to do query in html dom in testing?
- What is the use of detectChanges?
- How to test async service?
- How to test input and output ?
- How to test routing?
- How to test pipes?
Internationalization (i18n)
- How to provide the translation files?
- How to localize currency ?
- How to localize time?
Animation
- What is multiple transition state?
- How to animate entering and leaving view?
- What is complex animation sequence ?
- What is stagger group and sequence?
Schematics
- How to generate module with routing using cli
- How to create component without spec file?
PWA and Service worker
- What is PWA Progressive web app ?
- What is service work?
- Is Server Side render support service worker?
- How make app aware new version is available?
RxJS
- Explain the operator catchError,retry?
- What is Of and from operator?
- Explain switchmap?
- Define Subject and its types with difference?
- Difference between hot and cold observable?
- Define unicasting and multicasting?
- After an observable error will it get new value?
Security
- How to keep your app secure?
- How to bypass angular security?
Performance and optimization
- How you optimize your app?
- Difference between defer and async?
- What is CDN?
- How to make components lighter?
- How many ngmodel we can put in single page?
- What is tree shaking?