Angular Interview Practice Exam 2025 - Free Angular Practice Questions and Study Guide

Question: 1 / 400

What annotation is used to define a module in Angular?

@Component

@Directive

@NgModule

The annotation used to define a module in Angular is @NgModule. This decorator is essential for organizing an Angular application into cohesive blocks of functionality. It allows developers to group related components, directives, pipes, and services, thereby encapsulating specific functionalities and promoting modular design.

The @NgModule decorator takes a metadata object that configures the module. This includes declarations, which define the components and directives that are part of the module, as well as imports, which allow the module to bring in functionality from other modules. Additionally, it can specify providers for services that are available to the components in the module and bootstrap information for the root module.

In contrast, @Component is used to create components, @Directive is for custom directives allowing developers to extend HTML behavior, and @Service is intended for defining services that can be injected into components and other services. Each of these decorators serves a unique purpose within the Angular architecture, but @NgModule specifically relates to the definition and configuration of modules.

Get further explanation with Examzify DeepDiveBeta

@Service

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy