基本上如标题所述,我需要返回多个可观察值或一个结果。基本上,目标是加载并说出图书馆列表,然后根据该图书馆ID加载书籍。我不想在组件中调用服务,而是希望在页面加载之前先加载所有数据。
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import { UserService } from './../_services/index';
@Injectable()
export class LibraryResolver implements Resolve<any> {
constructor(private _userService: UserService) {}
resolve(route: ActivatedRouteSnapshot) {
return this._userService.getLibraryList();
}
}
Run Code Online (Sandbox Code Playgroud)
如何先加载图书馆列表,然后再加载每个图书馆的图书信息并返回到我的组件?
PS:我的服务通过ID加载了此方法
this.userService.getLibraryBooks(this.library["id"]).subscribe((response) => {
...
Run Code Online (Sandbox Code Playgroud) 有没有办法在 TextFormField 中放置“忘记密码”标签?

在示例图片上忘记密码?就在输入里面
new TextFormField(
decoration: InputDecoration(labelText: 'Password',
labelStyle: TextStyle(
color: Colors.black87,
fontSize: 17,
fontFamily: 'AvenirLight'
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.purple),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey,
width: 1.0)
),
),
style: TextStyle(
color: Colors.black87,
fontSize: 17,
fontFamily: 'AvenirLight'
),
controller: _passwordController,
obscureText: true,
),
Run Code Online (Sandbox Code Playgroud)