/ng-exercise-1

Angular Exercise 1

Primary LanguageHTML

Angular Exercise 1

This project was generated with Angular CLI version 16.0.3.

Tasks

Part 1

  • have a quick overview of the project structure
  • start the application
  • integrate Angular Material components with the project
  • integrate Material Theming for the components
  • integrate the Toolbar component to the app home page
  • integrate the Tabs component that takes the whole space on the page

Troubleshoting

If you run into issues with Theming integration, the following block from the material theming docs should help

@use '@angular/material' as mat;

@include mat.core();

$my-primary: mat.define-palette(mat.$indigo-palette, 500);
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);

$my-theme: mat.define-light-theme((
 color: (
   primary: $my-primary,
   accent: $my-accent,
 ),
 typography: mat.define-typography-config(),
 density: 0,
));

@include mat.all-component-themes($my-theme);

Part 2

  • add a new Button to the application toolbar, with the Notify caption and Send Notification Tooltip
  • introduce a new Angular service NotificationService as src/app/services/notification.service.ts
  • provide a public method to display a simple Snackbar with the provided message
  • inject the NotificationService into the main application component
  • for the click handler of the Notify button, invoke your custom NotificationService to display the notification message.

Part 3

  • run application unit tests
  • create a unit test for the NotificationService to cover the sending messages functionality

Resources

Development server

Run npm start for a dev server, it will automatically navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Running unit tests

Run ng test to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.