깜놀하는 해므찌로

Angular router params 데이터 받기 예시 본문

IT

Angular router params 데이터 받기 예시

agnusdei1207 2023. 6. 23. 15:07
반응형
SMALL
ngOnInit() {
    const item = this.orderService
      .getItems()
      .find((_item) => _item.id === +this.activateRoute.snapshot.params['id']);

    if (item) {
      this.order = item;
      this.setPage();
    }
  }

1. + 사용 시 문자열 -> 넘버타입으로 쉽게 변경 가능

반응형
LIST