Complete the code to import the shared module in the app module.
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { [1] } from './shared/shared.module'; @NgModule({ imports: [BrowserModule, SharedModule], bootstrap: [AppComponent] }) export class AppModule {}
You need to import SharedModule to use shared components in your app module.
Complete the code to export a reusable component from the shared module.
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ReusableComponent } from './reusable/reusable.component'; @NgModule({ declarations: [ReusableComponent], imports: [CommonModule], exports: [[1]] }) export class SharedModule {}
Exporting ReusableComponent makes it available to other modules that import SharedModule.
Fix the error in the shared module by completing the imports array.
import { NgModule } from '@angular/core'; import { [1] } from '@angular/common'; @NgModule({ imports: [CommonModule], declarations: [], exports: [] }) export class SharedModule {}
BrowserModule in shared modules (should only be in root module).CommonModule.CommonModule provides common directives like ngIf and ngFor needed in shared components.
Fill both blanks to create a shared module that declares and exports a component.
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { [1] } from './button/button.component'; @NgModule({ declarations: [[2]], imports: [CommonModule], exports: [ButtonComponent] }) export class SharedModule {}
You import and declare ButtonComponent so it can be exported and reused.
Fill all three blanks to create a shared module that imports CommonModule, declares, and exports a component.
import { NgModule } from '@angular/core'; import { [1] } from '@angular/common'; import { [2] } from './card/card.component'; @NgModule({ declarations: [[3]], imports: [CommonModule], exports: [CardComponent] }) export class SharedModule {}
Import CommonModule, import and declare CardComponent to export it for reuse.