Javascript 使用结构指令时如何获取自动地址?
嗨,当我使用Javascript 使用结构指令时如何获取自动地址?,javascript,angular,typescript,api,angular6,Javascript,Angular,Typescript,Api,Angular6,嗨,当我使用*ngIf或试图附加div时,我没有得到这个自动地址,否则它的工作完全正常。 我应该怎么做才能得到这个自动地址以及*ngIf并附加它呢 <div class="form-group label-floating"> <label class="control-label">Address1</label> <input type="text" class="form-control search-address" name="
*ngIf
或试图附加div
时,我没有得到这个自动地址,否则它的工作完全正常。
我应该怎么做才能得到这个自动地址以及*ngIf
并附加它呢
<div class="form-group label-floating">
<label class="control-label">Address1</label>
<input type="text" class="form-control search-address" name="address1" placeholder=" " [(ngModel)]="address1" #address1>
</div>
请给我建议一个好的解决方案,我可以使用这三种方法。
谢谢。您是否收到了输入框?您确定“位置”中包含任何数据吗?如果可以,请提供stackblitz示例?从places父div中删除
*ngIf=“isShow”
后重试,并检查它是否正常工作?Rohan Kumar-我尝试删除*ngIf和*ngFor。从那以后它就开始工作了。
<div *ngIf="isShow">
<div class="form-group label-floating" *ngFor="let place of places">
<label class="control-label">Place</label>
<input type="text" class="form-control search-address" name="address2" placeholder=" " [(ngModel)]="place.address2" #address2>
</div>
</div>
const address1 = new google.maps.places.Autocomplete(this.address1.nativeElement, { componentRestrictions: { country: 'IN' }, types: [this.adressType]
});
google.maps.event.addListener(address1, 'place_changed', () => { this.place = address1.getPlace(); this.invokeEvent(this.place);
});