What is metadata?
Using metadata is how we tell Angular how to process a class. When we use a component, it acts as a class unless we tell Angular that it’s a component, and we do this with the help of metadata. Metadata is attached in TypeScript using a decorator. Decorators are functions that know the configuration of classes and how they are supposed to work.
How is Dependency Hierarchy formed?
The dependency injection system of Angular is hierarchical. It consists of a tree of injectors that stands parallel to the application’s component tree. The Dependency Hierarchy is formed with the configurations. The reconfiguration of the injectors can be done at any given level of the component tree. The providers for different injectors can also be configured in the injector hierarchy.
Check out these Web Development Courses to get an in-depth understanding of Web Development!
6 Explain the MVVM architecture.
The MVVM architecture plays a significant role in eliminating tight coupling between the components. This architecture includes the following three parts:
5 What are lifecycle hooks in Angular?
When building an Angular app, there will be times when we need to execute some code at some specific event—such as when a component is initialized or displayed on the screen or when the component is being removed from the screen. This is what lifecycle hooks are used for. For example, if we have some event listener attached to an HTML element in a component, such as a button click or form submission, we can remove that event listener before removing the component from the screen, just like we can fetch some data and display it on the screen in a component after the component is loaded on the screen. To use a lifecycle hook, we can override some methods on a component, such as ngOnInit or ngAfterViewInit. These methods, if available on a component, will be called by Angular automatically. This is why these are called lifecycle hooks.
8 Explain different kinds of Angular directives.
There are three kinds of directives in Angular. Let’s discuss them:
Want to become an Angular expert? Join this Angular JS Course in Bangalore now!