Basic usage
Create the alert UI
Section titled “Create the alert UI”The DaisyUI library provides a nice looking UI for a alert
component that can be used to display a message to the user.
Instructions
Section titled “Instructions”-
Update the template of
alert-banner.html
file:<div role="alert" class="alert alert-vertical alert-info alert-soft"><span>12 unread messages. Tap to see.</span><div><button class="btn btn-sm">Deny</button><button class="btn btn-sm btn-primary">Accept</button></div></div>
Display the component
Section titled “Display the component”Let’s now display the banner in the TaskList
and TaskForm
components.
Instructions
Section titled “Instructions”-
Update the template of
task-list.html
file:<app-alert-banner /> -
Import the
AlertBanner
in thetask-list.ts
file:import {AlertBanner} from '../shared/components/alert-banner/alert-banner'And add it to the
@Component
decorator’simports
array:@Component({selector: "app-task-list",templateUrl: "./task-list.html",styleUrl: "./task-list.css",imports: [// other importsAlertBanner],}) -
Update the template of
task-form.html
file:<app-alert-banner /> -
Import the
AlertBanner
in thetask-form.ts
file:import {AlertBanner} from "../shared/components/alert-banner/alert-banner";And add it to the
@Component
decorator’simports
array:@Component({selector: "app-task-form",templateUrl: "./task-form.html",styleUrl: "./task-form.css",imports: [// other importsAlertBanner],}) -
Test the application.
You should see the banner displayed in both components.