我面临着一个让我发疯的问题。我正在开发一个有角度的项目,我需要将地图搜索放入模态窗口中。我使用了 ng bootstrap modals 和谷歌地图。
这是我的 .ts:
@Component({
selector: 'app-classroom-detail-dialog',
templateUrl: './classroom-detail-dialog.component.html',
styleUrls: ['./classroom-detail-dialog.component.css']
})
export class ClassroomDetailDialogComponent implements OnInit {
@Input() idClassroom: number;
classroom: Class;
edit: boolean = true;
public latitude: number;
public longitude: number;
public searchControl: FormControl;
@ViewChild("search") public searchElementRef: ElementRef;
constructor(public activeModal: NgbActiveModal, public classroomService: ClassroomService,
public mapsAPILoader: MapsAPILoader, public ngZone: NgZone) { }
ngOnInit() {
this.classroomService.getClassroomDetail(this.idClassroom).subscribe(classroom=>{
this.classroom = classroom;
this.latitude = this.classroom.latitude;
this.longitude = this.classroom.longitude;
});
//create search FormControl
this.searchControl = new FormControl();
//load Places Autocomplete …Run Code Online (Sandbox Code Playgroud)