routerLink with outlet重定向到404错误页面

时间:2017-09-12 01:23:08

标签: angular angular2-routing router-outlet

我有一个角度4应用程序,我无法设置工作 strActDuration = CStr(Math.Round((dblActual / dblPayAmount), 1)) Dim parts As String() = strActDuration.Split("."c) Dim strhour As Integer = 0 Dim strminutes As Integer = 0 If parts.Length = 1 Then strhour = Integer.Parse(parts(0)) strminutes = 0 ElseIf parts.Length = 2 Then strhour = Integer.Parse(parts(0)) strminutes = Integer.Parse(parts(1)) 'strroundminutes = CInt(Math.Round(strminutes, 3)) 'strroundminutes = CInt(Math.Truncate(strminutes / 10)) End If strCombineDuration = strhour & "Hr " & strminutes & "Min" 进行导航。该请求始终会重定向到我的404错误页面。

这是我的代码:

routerLink route-config 的相关部分:

NgModule

{ path: 'Transactions', component: TransactionIndexComponent, children: [ { path: 'Add', outlet: "next", component: TransactionAddComponent, children: [ { path: "AddPerson", component: PersonsAddComponent, outlet: "next" } ] }, ] }, 模板的相关部分:

TransactionsIndexComponent

<a routerLink="[{ outlets: { next: 'Add' } } ]" class="tile">Add</a> <router-outlet name="next"></router-outlet> 模板的相关部分:

TransactionAddComponent

我在<a routerLink="[{ outlets: { next: 'AddPerson' } } ]" class="tile">Add Person</a> <router-outlet name="next"></router-outlet> 中尝试了routerLink的这些值:

  1. TransactionsIndexComponent
  2. ['', { outlets: { next: 'Add' } } ]
  3. 他们都没有奏效。 有什么问题?

    PS:嵌套[{ outlets: { next: 'Add' } }]自带的模板正在运行,因为我可以毫无问题地打开像router-outlet这样的地址。

1 个答案:

答案 0 :(得分:0)

我发现了问题。我错过了multipart_form_data = { 'uploadphotos': (None, 'true', None), 'deletephoto': (None, '0', None), 'upload_input_0': ("test2.jpg", open('test2.jpg', 'rb'),'image/jpeg'), 'upload_path0': (None, 'C:\fakepath\test2.jpg', None), 'e$phMain$UploadButton0': (None, 'Upload photo', None), 'upload_input_1': ('', ''), 'upload_path1': (None, '', None), 'upload_input_2': ('', ''), 'upload_path2': (None, '', None), 'upload_input_3': ('', ''), 'upload_path3': (None, '', None), 'upload_input4': ('', ''), 'upload_path4': (None, '', None), 'upload_input_5': ('', ''), 'upload_path5': (None, '', None), 'upload_input_6': ('', ''), 'upload_path6': (None, '', None), 'upload_input_7': ('', ''), 'upload_path7': (None, '', None), } r = s.post(upload_image_url, headers = headers_s, files=multipart_form_data) 中的方括号。这很有效:

[routerLink]