Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为盎格鲁水疗中心实施路线';s应用程序_Html_Angular_Angular Router - Fatal编程技术网

Html 为盎格鲁水疗中心实施路线';s应用程序

Html 为盎格鲁水疗中心实施路线';s应用程序,html,angular,angular-router,Html,Angular,Angular Router,我想实现我的路由配置,并确保在基本角度应用程序中实现SPA功能!但问题是没有创建我的组件,我的目的是在我的侧导航中通过链接实现路由,而不创建一些特定的组件!因此,我保证了路由,但是,链接之间的导航没有嵌入SPA内容;因此,SPA特性不可用 应用程序路由.module.ts import { NgModule } from '@angular/core'; @NgModule({ // routes has the route configuration. // It

我想实现我的
路由
配置,并确保在基本
角度
应用程序中实现
SPA
功能!但问题是没有创建我的
组件
,我的目的是在我的
侧导航
中通过链接实现
路由
,而不创建一些特定的
组件
!因此,我保证了
路由
,但是,链接之间的
导航
没有嵌入
SPA
内容;因此,
SPA
特性不可用

应用程序路由.module.ts

import { NgModule } from '@angular/core';


@NgModule({        // routes has the route configuration. 
    // It is a variable of type Routes
      imports: [RouterModule.forRoot(routes)],  /* there is some error here  routes isnt defined ,I knew 
                                                   I have should have implemented paths and components 
                                                   but like I clarified above there is a component 
                                                   parameter for forRoot() method  . In my case I had no 
                                                   components I have only links */
      exports: [RouterModule]
    })

    export class AppRoutingModule { 
    }
主导航组件.html

  <mat-sidenav 
  #drawer class="sidenav" fixedInViewport="true"
      [attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
      [mode]="(isHandset$ | async) ? 'over' : 'side'"
      [opened]="!(isHandset$ | async)">
    <mat-toolbar>Menu</mat-toolbar>
    <mat-nav-list>
      <a mat-list-item href="City1">City 1</a>  <!-- link1 whom I want to apply SPA aspect -->
      <a mat-list-item href="City2">City 2</a>  <!-- link2 whom I want to apply SPA aspect -->
      <a mat-list-item href="City3">City 3</a>  <!-- link3 whom I want to apply SPA aspect -->
    </mat-nav-list>
  </mat-sidenav>
  <mat-sidenav-content>
    <mat-toolbar color="primary">
      <button
        type="button"
        aria-label="Toggle sidenav"
        mat-icon-button
        (click)="drawer.toggle()"
        *ngIf="isHandset$ | async">
        <mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
      </button>
      <span>City-routing</span>
    </mat-toolbar>
    <!-- Add Content Here -->
  </mat-sidenav-content>
</mat-sidenav-container>


菜单
菜单
城市路线

SPA方面仍然不显示;当我们从一个链接导航到另一个链接时,会出现加载,路径也不稳定;在导航中,它显示新路径,但突然路径恢复到其标准格式,但SPA方面仍不显示;当我们从一个链接导航到另一个链接时,会出现加载,路径也不稳定;在导航中,它显示了新路径,但突然路径恢复到其标准格式