value not updating in the view after data update , angular2 and typescript

前端 未结 2 1292
情书的邮戳
情书的邮戳 2021-01-23 23:04

this is my ngOnInit function

 instance.input = document.getElementById(\'google_places_ac\');
        autocomplete = new google.maps.places.Autocomp         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 23:39

    you can check this angular2 official docs for setting up the attributes,

    cheatsheet - https://angular.io/docs/ts/latest/cheatsheet.html

    
    

    Update

    import { Component, ChangeDetectorRef } from 'angular2/core';
    
    constructor(private cdr:ChangeDetectorRef) {
    }
    public setValue(a,b,c) {
        this.coutnry = a;
        this.state = b;
        this.city = c;
        this.sharedService.country = this.coutnry;
        this.sharedService.city = this.city;
        this.sharedService.state = this.state;
        console.log(a, b, c);
        this.cdr.detectChanges();
    }
    

提交回复
热议问题