小编hxd*_*def的帖子

Angular 4如何在解析器中返回多个可观察对象

基本上如标题所述,我需要返回多个可观察值或一个结果。基本上,目标是加载并说出图书馆列表,然后根据该图书馆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)

angular-routing angular-http angular angular-httpclient

5
推荐指数
2
解决办法
4516
查看次数

如何在 TextFormField 中添加额外的标签?

有没有办法在 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)

flutter flutter-layout

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