Angular ActivatedRoute by ID return null or Undefined

I want to pull data from the API to the dialog form by id for editing using activatedroute. When I define the ID section in URL, it returns as undefined or null. However, when I enter ID section in URL manually, I can pull data into the form. I think there is a problem with activatedroute. I would like to ask for help from those who have knowledge of this subject.

ngOnInit(): void {

    this.loadWaters();
    // this.id = this.route.snapshot.paramMap.get['id'];
    // this.id = this.route.snapshot.params['id'];
    // this.route.paramMap.subscribe(params => {
    //   console.log(params.get('id'));
    // });

    this.loadProducts();
    // this.id=this.activatedRoute.snapshot.paramMap.get('id');
    this.id = this.activatedRoute.snapshot.paramMap.get['id'];
    this.productService.getById(this.id)
      .pipe(first())
      .subscribe(x => this.productValidation.patchValue(x));
  
    this.productValidation = this.formBuilder.group({
      productCode: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(50)]],
      productName: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(50), Validators.pattern('^[a-zA-Z ]*$')]],
      bottleType: ['', [Validators.required]],
      palletType: ['', [Validators.required]],
      palletNumber: ['', [Validators.required]],
      recipeCode: ['', [Validators.required]],
      startBrix: ['', [Validators.required, Validators.min(0), Validators.max(11)]],
      endBrix: ['', [Validators.required, Validators.min(0), Validators.max(11)]],
      startCo2: ['', [Validators.required, Validators.min(0), Validators.max(10)]],
      endCo2: ['', [Validators.required, Validators.min(0), Validators.max(10)]],
      maschineCode: ['', [Validators.required]],
      expiryStartDate: [new FormControl((new Date())), [Validators.required]],
      expiryEndDate: [new FormControl((new Date())), [Validators.required]],
      nitrogen: [false],
      weight: ['', [Validators.required]],
      waterId: [''],
    });

    this.loadProducts();
    this.id=this.activatedRoute.snapshot.paramMap.get('id');
    this.productService.getById(this.id)
      .pipe(first())
      .subscribe(x => this.productValidation.patchValue(x));


  }





 private loadProducts() {
    this.productService.getById(this.id).pipe(first()).subscribe((data: ProductResponse) => {
      this.products = data.products;
    });

  }

Product Service

  getById(id:string): Observable<ProductResponse> {

    return this.httpclient.get<ProductResponse>('https://localhost:xxxx/api/Products/'+id).pipe(
      map((data) => data),
      catchError((error) => throwError(error))
    );
  }

}

export interface ProductResponse {
  products: Update_Products[ 

  ];
}

Html:

<div class="container-fluid">
    <p style="text-align: center; font-weight: bold; font-size: 20px;color: rgb(13, 13, 190);">Update Product</p>
    <form  [formGroup]="productValidation" >
  
        <mat-form-field appearance="outline" class="product-update">
            <mat-label>Product Code</mat-label>
            <input matInput #txtproductcode formControlName="productCode" >
            <mat-error *ngIf="productValidation.get('productCode')?.hasError('required')">
              Product Code is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('productCode')?.hasError('minlength')">
              Product Code should be atleast 5 characters long!
            </mat-error>
            <mat-error *ngIf="productValidation.get('productCode')?.hasError('maxlength')">
              Product Code can be atmax 50 characters long!
            </mat-error>
          </mat-form-field>


          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Product Name</mat-label>
            <input matInput #txtproductname formControlName="productName">
            <mat-error *ngIf="productValidation.get('productName')?.hasError('required')">
              Product Name is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('productName')?.hasError('minlength')">
              Product Name should be atleast 5 characters long!
            </mat-error>
            <mat-error *ngIf="productValidation.get('productName')?.hasError('maxlength')">
              Product Name can be atmax 50 characters long!
            </mat-error>
            <mat-error *ngIf="productValidation.get('productName')?.hasError('pattern')">
              Product Name not matched by pattern!
            </mat-error>
          </mat-form-field>

          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Bottle Type</mat-label>
            <input matInput #bottletype formControlName="bottleType">
            <mat-error *ngIf="productValidation.get('bottleType')?.hasError('required')">
              Bottle type is Required!
            </mat-error>
          </mat-form-field>
  
          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Pallet Type</mat-label>
            <input matInput #pallettype formControlName="palletType">
            <mat-error *ngIf="productValidation.get('palletType')?.hasError('required')">
              Pallet type is Required!
            </mat-error>
          </mat-form-field>
  
          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Pallet Number</mat-label>
            <input matInput #palletnumber formControlName="palletNumber">
            <mat-error *ngIf="productValidation.get('palletNumber')?.hasError('required')">
              Pallet number is Required!
            </mat-error>
          </mat-form-field>


          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Recipe Code</mat-label>
            <input matInput #recipecode formControlName="recipeCode">
            <mat-error *ngIf="productValidation.get('recipeCode')?.hasError('required')">
              Recipe code is Required!
            </mat-error>
          </mat-form-field>
  
          <section class="product-update">
            <mat-checkbox #nitrogen formControlName="nitrogen" class="example-margin">Nitrogen
            </mat-checkbox>
          </section>
  
          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Start Brix</mat-label>
            <input matInput type="number" min="0" value="0" #startbrix formControlName="startBrix">
            <mat-error *ngIf="productValidation.get('startBrix')?.hasError('required')">
              Start Brix value is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('startBrix')?.hasError('min')">
              Start Brix value cannot be negative!
            </mat-error>
            <mat-error *ngIf="productValidation.get('startBrix')?.hasError('max')">
              Start Brix value cannot be more than 10!
            </mat-error>
          </mat-form-field>
  
  
          <mat-form-field appearance="outline" class="product-update">
            <mat-label>End Brix</mat-label>
            <input matInput type="number" min="0" value="0" #endbrix formControlName="endBrix">
            <mat-error *ngIf="productValidation.get('endBrix')?.hasError('required')">
              End Brix value is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('endBrix')?.hasError('min')">
              End Brix value cannot be negative!
            </mat-error>
            <mat-error *ngIf="productValidation.get('endBrix')?.hasError('max')">
              End Brix value cannot be more than 10!
            </mat-error>
          </mat-form-field>
  
          <mat-form-field appearance="outline" class="product-update" >
            <mat-label>Start CO2</mat-label>
            <input matInput type="number" min="0" value="0" #startco2 formControlName="startCo2">
            <mat-error *ngIf="productValidation.get('startCo2')?.hasError('required')">
              Start CO2 value is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('startCo2')?.hasError('min')">
              Start CO2 value cannot be negative!
            </mat-error>
            <mat-error *ngIf="productValidation.get('startCo2')?.hasError('max')">
              Start CO2 value cannot be more than 10!
            </mat-error>
          </mat-form-field>
  
  
          <mat-form-field appearance="outline" class="product-update" >
            <mat-label>End CO2</mat-label>
            <input matInput type="number" min="0" value="0" #endco2 formControlName="endCo2" >
            <mat-error *ngIf="productValidation.get('endCo2')?.hasError('required')">
              End CO2 value is Required!
            </mat-error>
            <mat-error *ngIf="productValidation.get('endCo2')?.hasError('min')">
              End CO2 value cannot be negative!
            </mat-error>
            <mat-error *ngIf="productValidation.get('endCo2')?.hasError('max')">
              End CO2 value cannot be more than 10!
            </mat-error>
          </mat-form-field>

          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Weight</mat-label>
            <input matInput type="number" min="0" value="0" #weight formControlName="weight">
            <mat-error *ngIf="productValidation.get('weight')?.hasError('required')">
              Weight value is Required!
            </mat-error>
          </mat-form-field>
  
  
  
          <mat-form-field appearance="outline" class="product-update">
            <mat-label>Maschine Code</mat-label>
            <input matInput #maschinecode formControlName="maschineCode">
            <mat-error *ngIf="productValidation.get('maschineCode')?.hasError('required')">
              Maschine code is Required!
            </mat-error>
          </mat-form-field>

          <div>
            <mat-form-field class="product-update">
              <mat-label>Water</mat-label>
              <mat-select formControlName="waterId">
                <mat-option *ngFor="let water of waters" [value]="water.id">
                  {{water?.waterType}}
                </mat-option>
              </mat-select>
            </mat-form-field>
          </div>
  
  
  
          <mat-form-field class="product-update">
            <mat-label>Enter a date range</mat-label>
            <mat-date-range-input [rangePicker]="picker" >
              <input matStartDate placeholder="Start date" #expiryStartDate formControlName="expiryStartDate"
                data-date-format='YYYY-MM-DD'>
              <mat-error *ngIf="productValidation.get('expiryStartDate')?.hasError('required')">
                Expire date end value is Required!
              </mat-error>
              <input matEndDate placeholder="End date" #expiryenddate formControlName="expiryEndDate"
                data-date-format='YYYY-MM-DD'>
              <mat-error *ngIf="productValidation.get('expiryEndDate')?.hasError('required')">
                Expire date end value is Required!
              </mat-error>
            </mat-date-range-input>
            <mat-hint>YYYY/MM/DD – YYYY/MM/DD</mat-hint>
  
            <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
            <mat-date-range-picker #picker></mat-date-range-picker>
          </mat-form-field>
  
      <div style="text-align: center; width: auto;">
     <div style="margin:5px; display: inline-block;"><button mat-raised-button class="btn" color="primary" (click)="update()"
            >Create</button>
        </div>
  </div>
</form>

Update_Products

export class Update_Products {
  
  productCode : string;
  productName : string;
  bottleType : string;
  palletType : string;
  palletNumber : string;
  recipeCode : string;
  startBrix : number;
  endBrix : number;
  startCo2 : number;
  endCo2 : number;
  maschineCode : string;
  expiryStartDate : Date | string;
  expiryEndDate : Date | string;
  nitrogen :Boolean;
  weight :number;
  watertype :string;
}

dialog:
  update(id: string) {
    this.dialogService.openDialog({
      componentType: UpdateComponent,
      data: id,
      options: {
        width: "800px",
        height:"700px"
      }
    });
  }

5

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