동적 ID로 요소의 값을 가져 오거나 업데이트하려면 어떻게해야합니까?각도 2 동적 요소로 요소 가져 오기
<input type="text" class="form-control" id="{{'lat' + ind}}" formControlName="lat">
내가
this.someService.getData().subscribe(
(response) => {this.data = response.json()
this.lon = this.data.x;
this.lat = this.data.y;
this.ind = this.data.ind;
// UPDATE MY 'lat+ind' and 'lon+ind' HERE
},
(error) => console.log('ERROR: ' + error)
);
당신은 document.querySelector ('# 위도'+ this.ind)'DOM 요소 – JasonK
어떻게 값을 얻는 방법을 검색하는'사용할 수 있습니다 할 ChangeDetectorRef.detectChanges()를 사용할 수 있습니다 업데이트? –