Angular routing strategy not behaving as expectedAngular 2 Routing Does Not Work When Deployed to Http ServerLazy Load to route other than empty route in Angular 2Angular 4 ERROR Error: Uncaught (in promise): RangeError: Maximum call stack size exceededAngular4 multiple modules issueerror TS2707 : Generic type 'MatDialogRef<T,R>' requiers between 1 and 2 argumentsrouting navigate method not redirecting to targeted componentAngular loadChildren property absolute path to module is not working$Injector Error on Angular Upgrade from 1.6.6 to 6Core module component and Shared module implementation in angular

How to say "quirky" in German without sounding derogatory?

Mean π: Archimedes vs. Gauss - π computation through generalized means

How is Team Scooby Doo (Mystery Inc.) funded?

How to work with a technician hired with a grant who argues everything

Is English tonal for some words, like "permit"?

Might have gotten a coworker sick, should I address this?

Does an oscilloscope subtract voltages as phasors?

Relocation error, error code (127) after last updates

Why is the Digital 0 not 0V in computer systems?

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

Why island and not light?

Do ibuprofen or paracetamol cause hearing loss?

Is there an inconsistency about Natasha Romanoff's middle name in the MCU?

I was promised a work PC but still awaiting approval 3 months later so using my own laptop - Is it fair to ask employer for laptop insurance?

Is low emotional intelligence associated with right-wing and prejudiced attitudes?

Are Democrats more likely to believe Astrology is a science?

Writing a love interest for my hero

Parallel resistance in electric circuits

What was the relationship between Einstein and Minkowski?

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?

Are there any non-WEB re-implementation of TeX Core in recent years?

What exactly is a marshrutka (маршрутка)?

What is this unknown executable on my boot volume? Is it Malicious?

How do email clients "send later" without storing a password?



Angular routing strategy not behaving as expected


Angular 2 Routing Does Not Work When Deployed to Http ServerLazy Load to route other than empty route in Angular 2Angular 4 ERROR Error: Uncaught (in promise): RangeError: Maximum call stack size exceededAngular4 multiple modules issueerror TS2707 : Generic type 'MatDialogRef<T,R>' requiers between 1 and 2 argumentsrouting navigate method not redirecting to targeted componentAngular loadChildren property absolute path to module is not working$Injector Error on Angular Upgrade from 1.6.6 to 6Core module component and Shared module implementation in angular






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Using the new angular lazy routing strategy, I'm expecting the following scenario to work, however, it always assumes the routes don't exist.



Taken that I have one sub-directory in my application, called /admin with various view I'd like to render, for example, /admin/settings, /admin/action-centre, etc.



Normally, the routing would be /admin/route, however, for my strategy, I don't want to move my routes into app-routing.module.ts, rather, contain the routes for /admin within the admin-routing.module.ts file.



Then, in app-routing.module.ts, I'm applying a fallback '**' to an error view, should the routes not be found.



If I remove the '**' fallback, the routes work, however, the app always assumes my routes don't exist, within admin, and fails.



admin-routing.module.ts



import NgModule from '@angular/core';
import Routes, RouterModule from '@angular/router';
import SettingsComponent from 'app/admin/settings/settings.component';

const routes: Routes = [

path: 'settings',
component: SettingsComponent,
canActivate: [AuthRequiredGuard]

];

@NgModule(
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
)
export class AdminRoutingModule


admin.module.ts



import NgModule from '@angular/core';
import AdminRoutingModule from './admin-routing.module';
import CommonModule from '@angular/common';
import SettingsComponent from './settings/settings.component';

@NgModule(
declarations: [
SettingsComponent
],
imports: [
AdminRoutingModule,
CommonModule,
],
providers: [],
entryComponents: [],
)
export class AdminModule


app-routing.module.ts



import NgModule from '@angular/core';
import Routes, RouterModule from '@angular/router';
import AuthRequiredGuard from './guards/auth-required.guard';
import RouteManagerComponent from './route-manager/route-manager.component';
import ErrorsComponent from './errors/errors.component';

const routes: Routes = [

path: '',
redirectTo: 'redirect',
pathMatch: 'full'
,

path: 'redirect',
component: RouteManagerComponent,
canActivate: [AuthRequiredGuard]
,

path: '**',
component: ErrorsComponent

];

@NgModule(
imports: [RouterModule.forRoot(routes,

paramsInheritanceStrategy: 'always',
enableTracing: true
)],
exports: [RouterModule]
)
export class AppRoutingModule


app.module.ts



import BrowserModule from '@angular/platform-browser';
import NgModule, Injector, ErrorHandler from '@angular/core';
import HttpModule from '@angular/http';
import HttpClientModule, HTTP_INTERCEPTORS from '@angular/common/http';
import BrowserAnimationsModule from '@angular/platform-browser/animations';
import AppRoutingModule from './app-routing.module';
import AppComponent from './app.component';
import AppInjector from 'app/appinjector.module';
import AdminModule from 'app/admin/admin.module';
import HttpInterceptorModule from './interceptors/http-interceptor.module';
import AuthRequiredGuard from 'app/guards/auth-required.guard';
import ErrorsComponent from './errors/errors.component';
import CustomErrorHandler from './custom-error-handler';

@NgModule(
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
HttpModule,
AppRoutingModule,
AdminModule
],
providers: [
AuthRequiredGuard,

provide: ErrorHandler,
useClass: CustomErrorHandler

],
bootstrap: [AppComponent]
)
export class AppModule
constructor(injector: Injector)
AppInjector.setInjector(injector);












share|improve this question






























    0















    Using the new angular lazy routing strategy, I'm expecting the following scenario to work, however, it always assumes the routes don't exist.



    Taken that I have one sub-directory in my application, called /admin with various view I'd like to render, for example, /admin/settings, /admin/action-centre, etc.



    Normally, the routing would be /admin/route, however, for my strategy, I don't want to move my routes into app-routing.module.ts, rather, contain the routes for /admin within the admin-routing.module.ts file.



    Then, in app-routing.module.ts, I'm applying a fallback '**' to an error view, should the routes not be found.



    If I remove the '**' fallback, the routes work, however, the app always assumes my routes don't exist, within admin, and fails.



    admin-routing.module.ts



    import NgModule from '@angular/core';
    import Routes, RouterModule from '@angular/router';
    import SettingsComponent from 'app/admin/settings/settings.component';

    const routes: Routes = [

    path: 'settings',
    component: SettingsComponent,
    canActivate: [AuthRequiredGuard]

    ];

    @NgModule(
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
    )
    export class AdminRoutingModule


    admin.module.ts



    import NgModule from '@angular/core';
    import AdminRoutingModule from './admin-routing.module';
    import CommonModule from '@angular/common';
    import SettingsComponent from './settings/settings.component';

    @NgModule(
    declarations: [
    SettingsComponent
    ],
    imports: [
    AdminRoutingModule,
    CommonModule,
    ],
    providers: [],
    entryComponents: [],
    )
    export class AdminModule


    app-routing.module.ts



    import NgModule from '@angular/core';
    import Routes, RouterModule from '@angular/router';
    import AuthRequiredGuard from './guards/auth-required.guard';
    import RouteManagerComponent from './route-manager/route-manager.component';
    import ErrorsComponent from './errors/errors.component';

    const routes: Routes = [

    path: '',
    redirectTo: 'redirect',
    pathMatch: 'full'
    ,

    path: 'redirect',
    component: RouteManagerComponent,
    canActivate: [AuthRequiredGuard]
    ,

    path: '**',
    component: ErrorsComponent

    ];

    @NgModule(
    imports: [RouterModule.forRoot(routes,

    paramsInheritanceStrategy: 'always',
    enableTracing: true
    )],
    exports: [RouterModule]
    )
    export class AppRoutingModule


    app.module.ts



    import BrowserModule from '@angular/platform-browser';
    import NgModule, Injector, ErrorHandler from '@angular/core';
    import HttpModule from '@angular/http';
    import HttpClientModule, HTTP_INTERCEPTORS from '@angular/common/http';
    import BrowserAnimationsModule from '@angular/platform-browser/animations';
    import AppRoutingModule from './app-routing.module';
    import AppComponent from './app.component';
    import AppInjector from 'app/appinjector.module';
    import AdminModule from 'app/admin/admin.module';
    import HttpInterceptorModule from './interceptors/http-interceptor.module';
    import AuthRequiredGuard from 'app/guards/auth-required.guard';
    import ErrorsComponent from './errors/errors.component';
    import CustomErrorHandler from './custom-error-handler';

    @NgModule(
    declarations: [
    AppComponent
    ],
    imports: [
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    HttpModule,
    AppRoutingModule,
    AdminModule
    ],
    providers: [
    AuthRequiredGuard,

    provide: ErrorHandler,
    useClass: CustomErrorHandler

    ],
    bootstrap: [AppComponent]
    )
    export class AppModule
    constructor(injector: Injector)
    AppInjector.setInjector(injector);












    share|improve this question


























      0












      0








      0








      Using the new angular lazy routing strategy, I'm expecting the following scenario to work, however, it always assumes the routes don't exist.



      Taken that I have one sub-directory in my application, called /admin with various view I'd like to render, for example, /admin/settings, /admin/action-centre, etc.



      Normally, the routing would be /admin/route, however, for my strategy, I don't want to move my routes into app-routing.module.ts, rather, contain the routes for /admin within the admin-routing.module.ts file.



      Then, in app-routing.module.ts, I'm applying a fallback '**' to an error view, should the routes not be found.



      If I remove the '**' fallback, the routes work, however, the app always assumes my routes don't exist, within admin, and fails.



      admin-routing.module.ts



      import NgModule from '@angular/core';
      import Routes, RouterModule from '@angular/router';
      import SettingsComponent from 'app/admin/settings/settings.component';

      const routes: Routes = [

      path: 'settings',
      component: SettingsComponent,
      canActivate: [AuthRequiredGuard]

      ];

      @NgModule(
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule]
      )
      export class AdminRoutingModule


      admin.module.ts



      import NgModule from '@angular/core';
      import AdminRoutingModule from './admin-routing.module';
      import CommonModule from '@angular/common';
      import SettingsComponent from './settings/settings.component';

      @NgModule(
      declarations: [
      SettingsComponent
      ],
      imports: [
      AdminRoutingModule,
      CommonModule,
      ],
      providers: [],
      entryComponents: [],
      )
      export class AdminModule


      app-routing.module.ts



      import NgModule from '@angular/core';
      import Routes, RouterModule from '@angular/router';
      import AuthRequiredGuard from './guards/auth-required.guard';
      import RouteManagerComponent from './route-manager/route-manager.component';
      import ErrorsComponent from './errors/errors.component';

      const routes: Routes = [

      path: '',
      redirectTo: 'redirect',
      pathMatch: 'full'
      ,

      path: 'redirect',
      component: RouteManagerComponent,
      canActivate: [AuthRequiredGuard]
      ,

      path: '**',
      component: ErrorsComponent

      ];

      @NgModule(
      imports: [RouterModule.forRoot(routes,

      paramsInheritanceStrategy: 'always',
      enableTracing: true
      )],
      exports: [RouterModule]
      )
      export class AppRoutingModule


      app.module.ts



      import BrowserModule from '@angular/platform-browser';
      import NgModule, Injector, ErrorHandler from '@angular/core';
      import HttpModule from '@angular/http';
      import HttpClientModule, HTTP_INTERCEPTORS from '@angular/common/http';
      import BrowserAnimationsModule from '@angular/platform-browser/animations';
      import AppRoutingModule from './app-routing.module';
      import AppComponent from './app.component';
      import AppInjector from 'app/appinjector.module';
      import AdminModule from 'app/admin/admin.module';
      import HttpInterceptorModule from './interceptors/http-interceptor.module';
      import AuthRequiredGuard from 'app/guards/auth-required.guard';
      import ErrorsComponent from './errors/errors.component';
      import CustomErrorHandler from './custom-error-handler';

      @NgModule(
      declarations: [
      AppComponent
      ],
      imports: [
      BrowserModule,
      BrowserAnimationsModule,
      HttpClientModule,
      HttpModule,
      AppRoutingModule,
      AdminModule
      ],
      providers: [
      AuthRequiredGuard,

      provide: ErrorHandler,
      useClass: CustomErrorHandler

      ],
      bootstrap: [AppComponent]
      )
      export class AppModule
      constructor(injector: Injector)
      AppInjector.setInjector(injector);












      share|improve this question














      Using the new angular lazy routing strategy, I'm expecting the following scenario to work, however, it always assumes the routes don't exist.



      Taken that I have one sub-directory in my application, called /admin with various view I'd like to render, for example, /admin/settings, /admin/action-centre, etc.



      Normally, the routing would be /admin/route, however, for my strategy, I don't want to move my routes into app-routing.module.ts, rather, contain the routes for /admin within the admin-routing.module.ts file.



      Then, in app-routing.module.ts, I'm applying a fallback '**' to an error view, should the routes not be found.



      If I remove the '**' fallback, the routes work, however, the app always assumes my routes don't exist, within admin, and fails.



      admin-routing.module.ts



      import NgModule from '@angular/core';
      import Routes, RouterModule from '@angular/router';
      import SettingsComponent from 'app/admin/settings/settings.component';

      const routes: Routes = [

      path: 'settings',
      component: SettingsComponent,
      canActivate: [AuthRequiredGuard]

      ];

      @NgModule(
      imports: [RouterModule.forChild(routes)],
      exports: [RouterModule]
      )
      export class AdminRoutingModule


      admin.module.ts



      import NgModule from '@angular/core';
      import AdminRoutingModule from './admin-routing.module';
      import CommonModule from '@angular/common';
      import SettingsComponent from './settings/settings.component';

      @NgModule(
      declarations: [
      SettingsComponent
      ],
      imports: [
      AdminRoutingModule,
      CommonModule,
      ],
      providers: [],
      entryComponents: [],
      )
      export class AdminModule


      app-routing.module.ts



      import NgModule from '@angular/core';
      import Routes, RouterModule from '@angular/router';
      import AuthRequiredGuard from './guards/auth-required.guard';
      import RouteManagerComponent from './route-manager/route-manager.component';
      import ErrorsComponent from './errors/errors.component';

      const routes: Routes = [

      path: '',
      redirectTo: 'redirect',
      pathMatch: 'full'
      ,

      path: 'redirect',
      component: RouteManagerComponent,
      canActivate: [AuthRequiredGuard]
      ,

      path: '**',
      component: ErrorsComponent

      ];

      @NgModule(
      imports: [RouterModule.forRoot(routes,

      paramsInheritanceStrategy: 'always',
      enableTracing: true
      )],
      exports: [RouterModule]
      )
      export class AppRoutingModule


      app.module.ts



      import BrowserModule from '@angular/platform-browser';
      import NgModule, Injector, ErrorHandler from '@angular/core';
      import HttpModule from '@angular/http';
      import HttpClientModule, HTTP_INTERCEPTORS from '@angular/common/http';
      import BrowserAnimationsModule from '@angular/platform-browser/animations';
      import AppRoutingModule from './app-routing.module';
      import AppComponent from './app.component';
      import AppInjector from 'app/appinjector.module';
      import AdminModule from 'app/admin/admin.module';
      import HttpInterceptorModule from './interceptors/http-interceptor.module';
      import AuthRequiredGuard from 'app/guards/auth-required.guard';
      import ErrorsComponent from './errors/errors.component';
      import CustomErrorHandler from './custom-error-handler';

      @NgModule(
      declarations: [
      AppComponent
      ],
      imports: [
      BrowserModule,
      BrowserAnimationsModule,
      HttpClientModule,
      HttpModule,
      AppRoutingModule,
      AdminModule
      ],
      providers: [
      AuthRequiredGuard,

      provide: ErrorHandler,
      useClass: CustomErrorHandler

      ],
      bootstrap: [AppComponent]
      )
      export class AppModule
      constructor(injector: Injector)
      AppInjector.setInjector(injector);









      angular






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 9:47









      PeculiarJoePeculiarJoe

      264 bronze badges




      264 bronze badges

























          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394514%2fangular-routing-strategy-not-behaving-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394514%2fangular-routing-strategy-not-behaving-as-expected%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현