小编Nya*_*aha的帖子

.asObservable不想使用Observable.forkJoin

我有服务:

export class ConfigService {
  private _config: BehaviorSubject<object> = new BehaviorSubject(null);
  public config: Observable<object> = this._config.asObservable();

  constructor(private api: APIService) {
    this.loadConfigs();
  }

  loadConfigs() {
   this.api.get('/configs').subscribe( res => this._config.next(res) );
  }
}
Run Code Online (Sandbox Code Playgroud)

试图从组件中调用它:

...
Observable.forkJoin([someService.config])
  .subscribe( res => console.log(res) ) //not working 

someService.config.subscribe( res => console.log(res) ) // working
...
Run Code Online (Sandbox Code Playgroud)

如何使用Observable.forkJoinObservable变量config

我需要在服务中存储配置并等待它们点亮它们并且其他请求没有完成停止加载器.

javascript fork-join observable rxjs angular

4
推荐指数
1
解决办法
593
查看次数

如何在Angle 4+中获取FormControl的完整路径

如何在Angle 4+中获取FormControl的完整路径?

我有反应形式:

{
    name: '',
    address: {
        city: '',
        country: ''
    }
}
Run Code Online (Sandbox Code Playgroud)

而且我需要获得完整的控制权:

const addressFormGroup = this.form.get('address');
const cityControl = addressFormGroup.get('city');
cityControl.plsGiveMeFullPath() //address.city
Run Code Online (Sandbox Code Playgroud)

有没有现有的方法来获取cityControl的完整路径:FormGroup?

typescript angular angular-reactive-forms angular-forms

4
推荐指数
1
解决办法
858
查看次数