1
私はこのURL http://localhost/calls
を訪れていますが、角負荷を減らすと私のURLはhttp://localhost/
に変わります。角は常にインデックスページにリダイレクト
Router Event: NavigationStart
platform-browser.umd.js:1051 NavigationStart(id: 1, url: '/')
platform-browser.umd.js:1051 NavigationStart {id: 1, url: "/"}
core.umd.js:2957 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
platform-browser.umd.js:1060 Router Event: RoutesRecognized
platform-browser.umd.js:1051 RoutesRecognized(id: 1, url: '/', urlAfterRedirects: '/', state: Route(url:'', path:''))
platform-browser.umd.js:1051 RoutesRecognized {id: 1, url: "/", urlAfterRedirects: "/", state: RouterStateSnapshot}
platform-browser.umd.js:1060 Router Event: GuardsCheckStart
platform-browser.umd.js:1051 GuardsCheckStart(id: 1, url: '/', urlAfterRedirects: '/', state: Route(url:'', path:''))
platform-browser.umd.js:1051 GuardsCheckStart {id: 1, url: "/", urlAfterRedirects: UrlTree, state: RouterStateSnapshot}
platform-browser.umd.js:1060 Router Event: GuardsCheckEnd
platform-browser.umd.js:1051 GuardsCheckEnd(id: 1, url: '/', urlAfterRedirects: '/', state: Route(url:'', path:''), shouldActivate: true)
platform-browser.umd.js:1051 GuardsCheckEnd {id: 1, url: "/", urlAfterRedirects: UrlTree, state: RouterStateSnapshot, shouldActivate: true}
platform-browser.umd.js:1060 Router Event: NavigationEnd
platform-browser.umd.js:1051 NavigationEnd(id: 1, url: '/', urlAfterRedirects: '/')
platform-browser.umd.js:1051 NavigationEnd {id: 1, url: "/", urlAfterRedirects: "/"}
全ルートを要求されるように:トレースHTTPヘッダー
ルートには '場所' はありません
import { RouterModule, Routes } from '@angular/router'
import { CallOperatorAuthComponent } from './auth/call-operator-auth/call-operator-auth.component'
import { CallOperatorAuthGuard } from './auth/call-operator-auth/call-operator-auth.guard'
import { DashboardComponent } from './dashboard/dashboard.component
import { AppComponent } from './app.component'
// TODO: try later implement lazy loading again
const appRoutes: Routes = [
{path: 'login', component: CallOperatorAuthComponent},
{
path: 'calls',
component: CallsComponent,
canActivate: [ CallOperatorAuthGuard ]
},
]
export const routing = RouterModule.forRoot(appRoutes,
{ enableTracing: true })
アンギュラ4.4.3
EDITは、これが私のcanActivateです:
canActivate() {
if (this.localStorage.get('user')) {
return true
}
this.router.navigate([ '/login' ]) return false;
}
これはなんですか? 'children:callsRoutes、' ?? –
あなたの 'callsRoutes'オブジェクトを表示します。 –
ああ、ここでテストして投稿するときに、その文字列を削除しました。それは問題ではありません。初めて子どもに何か問題があると思った – x1site