What are decorators in Angular? Decorators are functions that modify JavaScript classes. These help to add metadata to classes. Angular defines a number of decorators that attach specific kinds of metadata to classes so that Angular can configure their behavior. For example- @Component defines classes as components.
Angular consists of different modules. The root module usually called the AppModule is the starting point of the application. It may import functionality from other feature modules. A module in Angular consists of components, directives, services, etc. The template along with metadata & component forms the view. The template and component interact with each other using data binding. The different directives modify the structure of the DOM. Services provide data to the component.
What is Angular? Angular is a TypeScript-based open-source web application framework.
32) How can you set, get, and clear cookies in AngularJS?
You can use:
Service method in AngularJS helps you to define service and method to it. In the following example, we have injected a simple addition service, which adds two numbers.
What is “$rootScope” in AngularJS?
A scope provides a separation between View and its Model. Every application has a $rootScope provided by AngularJS and every other scope is its child scope.
Using $Rootscope
Using rootscope we can set the value in one controller and read it from the other controller.
The following is the sample code snippet,
As we know, Rootscope is the top-level data container in AngularJs, we can keep any data in rootscope and read it when needed.
13) Explain directives and their types
During compilation process, when specific HTML function is triggered, it is referred to as directive. It is executed when the compiler encounters it in the DOM.
Different types of directives are:
62) What is the Ahead of Time Compilation?
Angular AOT (Ahead of Time) is a compiler that converts your angular HTML and typescript code into the JavaScript code.
28) Explain ng-click directives in AngularJS with example
Ng-click directives can be used in a scenario when you have to click on the button or want to perform any operation.
Example:
What is ngOnInit? How is it defined?Â
ngOnInit is a lifecycle hook and a callback method that is run by Angular to indicate that a component has been created. It takes no parameters and returns a void type.
export class MyComponent implements OnInit {
  ngOnInit(): void {
69) Explain parameterized pipe in AngularJS
In angularJS, pipes can have more than one parameter in order to tune the fine output. You can create a parameterized pipe by declaring the pipe with colon(:) and values of parameter. Developer can separate multiple parameter values with colon(:).
Routing is a method of merging various views. The controller takes the decision to combine these views depend on logical needs.
3 What does Angular Material means?
Angular Material is a user interface component package that enables professionals to create a uniform, appealing, and fully functioning websites, web pages, and web apps. It does this by adhering to contemporary web design concepts such as gentle degradation and browser probability.
ngOnInit is a lifecycle hook and callback function used by Angular to mark the creation of a component. It accepts no arguments and returns a void type.
Example: