Angular 17 – Dialog component not styled

First of all I’m new to Angular (1 week experience)
Problem: I try to edit a ToDo from my ToDo-List via a dialog. I pass in the parameters of my listItem and in the dialog i want to change the title. The data binding works perfectly, but the styling of the dialog is completely awkward. Can you please help me to figure out my problem?

todo-list.component.html

<div class="card shadow-lg mt-5 bg-light">
  <div class="card-header text-center border-0"></div>
  <div class="card-body p-4 bg-light">
    <ul class="list-group">
      <div *ngIf="todos.length === 0" class="text-center text-muted">Nothing to do, enjoy some free time my love!</div>      <li
        class="list-group-item mb-2 border py-3 rounded-3 p-4"
        *ngFor="let item of todos"
        [ngClass]="{
          'bg-success': item.priority == 1,
          'bg-warning': item.priority == 2,
          'bg-danger': item.priority == 3
        }"
      >
        <span>
          <i
            (click)="completeToDo(item.id, !item.isDone)"
            [ngClass]="
              item.isDone ? 'fa-solid fa-circle-check fa-xl' : 'fa-regular fa-circle fa-xl'
            "
          ></i>
          <i class="p-3"
            [ngStyle]="{
              'text-decoration': item.isDone ? 'line-through' : 'none'
            }"
            [ngClass]="{
              'text-white': item.priority != 2
            }"
          >
            {{ item.title }}
          </i>
          <span class="float-end text-dark" (click)="deleteToDo(item.id)">
            <i class="fa-solid fa-trash-can"></i>
          </span>
          <span class="float-end text-dark px-3" (click)="openDialog(item)">
            <i class="fa-solid fa-pen-to-square"></i>
          </span>
        </span>
      </li>
    </ul>
  </div>
</div>

todo-list.component.ts

import { Component } from '@angular/core';
import { TodoService } from '../../services/todo.service';
import { UpdateTodoDialogComponent } from '../update-todo-dialog/update-todo-dialog.component';
import {
  MatDialog,
  MAT_DIALOG_DATA,
  MatDialogRef,
  MatDialogTitle,
  MatDialogContent,
  MatDialogActions,
  MatDialogClose,
} from '@angular/material/dialog';

@Component({
  selector: 'app-todo-list',
  templateUrl: './todo-list.component.html',
  styleUrl: './todo-list.component.css'
})
export class TodoListComponent {

  todos: any[] = [];

  constructor(private todoService: TodoService, public dialog: MatDialog) {}

  ngOnInit(): void {
    this.todoService.firestoreCollection.valueChanges({idField:'id'}).subscribe((item) => {
      this.todos = item.sort((a:any, b:any) => {return b.priority - a.priority});
    });
  }

  completeToDo(id:string, newStatus:boolean): void {
    this.todoService.completeToDo(id, newStatus);
  }

  deleteToDo(id:string): void {
    this.todoService.deleteToDo(id);
  }

  updateToDo(id:string, newTitle:string): void {
    this.todoService.updateToDo(id, newTitle);
  }

  openDialog(item: any): void {

    const dialogRef = this.dialog.open(UpdateTodoDialogComponent, {
      width: '250px',
      data: {id: item.id, title: item.title}
    });

    dialogRef.afterClosed().subscribe(newTitle => {
      if (newTitle) {
        this.updateToDo(item.id, newTitle);
      }
    });
  }
}

update-todo-dialog.component.html

<div class="container justify-content-center">
    <h2 mat-dialog-title>Edit To Do</h2>
    <mat-dialog-content>
      <mat-form-field>
        <input matInput [(ngModel)]="data.title" />
      </mat-form-field>
    </mat-dialog-content>
    <mat-dialog-actions>
      <button mat-button (click)="onNoClick()">Cancel</button>
      <button mat-button [mat-dialog-close]="data.title" cdkFocusInitial>
        Done
      </button>
    </mat-dialog-actions>
</div>

update-todo-dialog.component.ts

import { Component, Inject } from '@angular/core';
import {
  MatDialog,
  MAT_DIALOG_DATA,
  MatDialogRef,
  MatDialogTitle,
  MatDialogContent,
  MatDialogActions,
  MatDialogClose,
} from '@angular/material/dialog';


@Component({
  selector: 'app-update-todo-dialog',
  templateUrl: './update-todo-dialog.component.html',
  styleUrl: './update-todo-dialog.component.css'
})
export class UpdateTodoDialogComponent {

  constructor(
    public dialogRef: MatDialogRef<UpdateTodoDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public data: any,
  ) {}

  onNoClick(): void {
    this.dialogRef.close();
  }
}

app.module.ts

import { AppComponent } from './app.component';
import { TodoListComponent } from './components/todo-list/todo-list.component';
import { TodoComponent } from './components/todo/todo.component';
import {MatRadioModule} from '@angular/material/radio';
import { FormsModule } from '@angular/forms';
import {MatDialogModule} from "@angular/material/dialog";
import { UpdateTodoDialogComponent } from './components/update-todo-dialog/update-todo-dialog.component';
import { MatFormFieldModule } from '@angular/material/form-field';

@NgModule({
  declarations: [
    AppComponent,
    TodoListComponent,
    TodoComponent,
    UpdateTodoDialogComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    AngularFireModule.initializeApp(environment.firebase),
    AngularFirestoreModule,
    MatRadioModule, 
    FormsModule,
    MatDialogModule, 
    MatFormFieldModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.html

<div class="container">
  <div class="row justify-content-center">
    <div class="col-md-6">
      <app-todo></app-todo>
      <app-todo-list></app-todo-list>
    </div>
  </div>
</div>

I expect it to look styled like in the documentation:
enter image description here

But it looks like this:
enter image description here

New contributor

Julien is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật