Angular 2路由器创建错误的链接

时间:2017-06-16 08:14:45

标签: angular angular-ui-router angular-cli angular-routing

我在路由中有类似的东西

const routes: Routes = [
    {
        path: '',
        component : HomeComponent,
        children: []
    },
    {
        path: 'login',
        children: [
            {
                path: '',
                component: LoginComponent
            },
            {
                path: 'with-email',
                component: LoginWithEmailComponent
            },
            {
                path: 'forgot-password',
                component: LoginForgotPasswordComponent
            }
        ]
    }   
];

它工作正常,直到我使用电子邮件页面,并做这样的事情

  <span><a routerLink="forgot-password"><i class="p1-icon-arrow"></i>Forgot password?</a></span>

它不会支持我登录和忘记密码,它会创建一个像这样的链接

/登录/与电子邮件/忘记密码

为什么它不支持 login / forgot-passwprd

1 个答案:

答案 0 :(得分:3)

在电子邮件页面(如果是LoginWithEmailComponent)中,它应该是

at Request.init (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/request.js:460:31)
at new Request (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/request.js:130:8)
at request (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/request/index.js:54:10)
at DefaultTransporter.request (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/google-auth-library/lib/transporters.js:58:10)
at Discovery.discoverAPI (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/googleapis/lib/discovery.js:261:19)
at GoogleApis.discoverAPI (/usr/local/lib/node_modules/@google-cloud/functions-emulator/node_modules/googleapis/lib/googleapis.js:182:13)
at Promise (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:98:14)
at RestClient.getService (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:90:12)
at RestClient._action (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:31:17)
at RestClient.listFunctions (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:131:17)