Angular 8 面接の質問と回答
質問 21. Explain the concept of Angular decorators.
Decorators in Angular are functions that modify the behavior of classes, methods, or properties. They are used to annotate and configure Angular components, directives, services, and modules.
Example:
@Component({
selector: 'app-root',
template: 'Hello World
',
})
質問 22. What are Angular guards and how are they used?
Angular guards are used to control the navigation to or from a route. There are different types of guards, such as CanActivate, CanDeactivate, CanLoad, and Resolve. They are implemented as services and can be added to route configurations.
Example:
canActivate: [AuthGuard]
質問 23. Explain the concept of Angular directives.
Directives in Angular are markers on a DOM element that tell Angular to attach a specified behavior to that DOM element or its children. Directives can be structural (changing the structure of the DOM) or attribute (changing the behavior or appearance of the DOM).
Example:
This is visible
質問 24. What is Angular CLI and how is it useful?
Angular CLI (Command Line Interface) is a command-line tool that facilitates the development, testing, and deployment of Angular applications. It provides commands for creating components, services, modules, building, testing, and more, making it easier to manage the development workflow.
Example:
ng generate component my-component
質問 25. Explain the use of *ngFor and *ngIf directives.
*ngFor is a structural directive in Angular used for iterating over a list of items and creating a template for each item. *ngIf is a structural directive that conditionally includes or excludes elements based on an expression.
Example:
{{ item }}This is shown if the condition is true
ユーザー評価で最も役立つ内容: