angular - Angular2 cascadingDropdown how can i reset state value when I change Country value -


here i'm implementing cascading dropdownlist when change country value state-->city coming when change country why city value not reset

export class employeecomponent{ countrydata: country[];     statedata: state[];     citysdata:city[]  gecountery() {         return this._cascadingservice.getcountrylist()             .subscribe(data => { this.countrydata = data }, error => { alert('servicenotavailable') })     }     getstate(id: number) {          return this._cascadingservice.getstates(id).subscribe(data => { this.statedata = data }, error => ('service not available...'));     }     selectcity(id: number) {         return this._cascadingservice.getcitys(id).subscribe(data => { this.citysdata = data }, error => ('service not available...'));     } 

add code in ur stateselected

onselect(id: number) { this.citysdata = null return this._cascadingservice.getstates(id).subscribe(data => { this.statedata = data,this.statedata=[] }, error => ('service not available...')); }


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -