ngOnInit():void{ this.register.generateUserName().subscribe(rep =>{ if(rep.meta.code == "88"){ this.form.patchValue({ username:rep.data.username }); } }); }
this.form.patchValue 只会重新赋对应name的值,原form的值不变。
this.form.reset 会全部赋值
ngOnInit():void{ this.register.generateUserName().subscribe(rep =>{ if(rep.meta.code == "88"){ this.form.patchValue({ username:rep.data.username }); } }); }
this.form.patchValue 只会重新赋对应name的值,原form的值不变。
this.form.reset 会全部赋值