Some basic questions going from easy to difficult. A more exhaustive list of more questions from the community can be found here.
- Whats the difference between components and directives? [ANSWER]: Components are widgets while directives more like decorators for elements and/or components.
- How do you get a reference to a child component? [ANSWER]:
ViewChild
/ViewChildren
orContentChild
/ContentChildren
- What is the difference between
ViewChild
andContentChild
? - Whats the difference between
NgModules
and ES2015 Modules? - How do you lazy load components and why is lazy loading important?
- Explain Observables and why they are useful.
- What pipe do you use to subscribe to a observable in a template? [ANSWER]:
async
- What are the lifecycle methods in Angular components? [ANSWER]: https://angular.io/guide/lifecycle-hooks
- How do you listen for events in a component? [ANSWER]:
HostListener
or viaelementRef.nativeElement
- Explain what
OnPush
change detection in components is. [ANSWER]: CD is ran when a immutable property is reset vs dirty checking as normal. - Whats the difference between template and reactive forms and why would you use one or the other?
- What is depedency injection and why is it useful?
- How do you resolve data before a route is loaded? [ANSWER]: Route Resolvers
- What is
ViewEncapsulation
? - Explain content projection. (ie
ng-content
) - What are route guards and why are they useful?
- What is Zones? What are they used for?
- What are auxiliary routes?
- How do you force a change detection cycle? [ANSWER]:
changeDetectorRef.markForCheck
ORchangeDetectorRef.detectChanges()
.
Whats the different between changeDetectorRef.markForCheck
and changeDetectorRef.detectChanges()
?
- What does
Expression has changed after it was checked
error mean? - What is tree shaking?
- What is
ng-container
and why is it useful? - How would you get a reference to a parent component? [ANSWER]: Inject it in the constructor.
- What does
forwardRef
do? - What are rxjs letttable operators?
- What are
entryComponents
? - Explain change detection in Angular?
- Explain what AoT is and how it differs from JIT?
- What is Redux pattern and explain why its useful.
- When building custom form components, what interface do they components need to implement to particpate in forms? [ANSWER]:
ControlValueAccessor
g'bye lettables...
https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md