컴퓨터/Angular
-
[Angular, RxJS] 트러블슈팅 사례와 놓치기 쉬운 주요 팁컴퓨터/Angular 2025. 7. 17. 12:03
트러블슈팅* [Angular, RxJS] POST 후 GET, 최신 데이터를 받아오지 못한 이슈 수정https://ksj12172.tistory.com/1533 놓치기 쉬운 팁* RadioControlValueAccessor (https://angular.dev/api/forms/RadioControlValueAccessor#)여러 개 선택지가 있고, 그 중 하나의 값을 고르는 UI에서 쓸 수 있다. input.type="radio"를 쓰고 formControl을 연결하면 구현해야 할 기능이 줄어든다. 예를 들어, checked 값을 따로 주지 않아도 된다. checked property에 값을 넘기기 위해 equality 체크하던 코드가 필요없어진다!
-
[Angular, RxJS] POST 후 GET, 최신 데이터를 받아오지 못한 이슈 수정컴퓨터/Angular 2025. 7. 17. 11:49
* switchMap으로 http.post나 http.delete를 하고subscribe에서 http.get을 하면 확률은 적으나 최신 get을 못 받는 상황이 생길 수 있다.someEvent$.pipe( switchMap(eventData => this.http.post('/api/some-url', eventData))).subscribe(postResult => { // 이 GET 요청은 바깥쪽 switchMap의 통제를 받지 않습니다. this.http.get('/api/other-url').subscribe(getResult => { this.data = getResult; });}); post 요청 1 => get 요청 1 => post 요청 2 => switchMap이라 post..