angular-router

Resolver does not resolve if another data stream is added

痴心易碎 提交于 2020-06-23 08:33:30
问题 I am trying to use a resolver in order to retrieve data depending on the given parameters the route holds. Unfortunately, the moment I add another data stream that my data depends on the resolver never actually resolves. If I directly return an immediately resolving value everything works fine. I debugged the situation to see that I receive all partial information but it just fails to actually resolve in the end. Here's a quick sample. Hit me up if there's more code needed to understand the

Ignore a path in the root RouterModule

六眼飞鱼酱① 提交于 2020-06-17 09:55:06
问题 I am using Angular 9. I have a JSON file in the root directory that I do not want included in the app. In other words: /src |-- /app |-- /assets |-- index.html |-- do_not_include_this_file.json This means http://example.com/do_not_include_this_file.json should be ignored by the RouterModule and instead go straight to the file. Currently that path will redirect to a PageNotFoundComponent, e.g. export const APP_ROUTER_PROVIDERS: Routes = [ { path: 'login', component: LoginComponent }, { path: '

How to navigate between pages in ionic 4 & 5?

折月煮酒 提交于 2020-06-15 10:16:38
问题 I had a project that I developed with ionic 3. But I took a break and when I started working again with ionic, I saw the navigation system change in the new versions. My project is a simple project. This project that lists the data in the a array and details about the data appear on a different page. I was doing this on Ionic 3: homepage.ts export class HomePage { items = []; constructor(public navCtrl: NavController) { this.initializeItems();} initializeItems() { this.items = [ { 'title':

How to navigate between pages in ionic 4 & 5?

泪湿孤枕 提交于 2020-06-15 10:13:16
问题 I had a project that I developed with ionic 3. But I took a break and when I started working again with ionic, I saw the navigation system change in the new versions. My project is a simple project. This project that lists the data in the a array and details about the data appear on a different page. I was doing this on Ionic 3: homepage.ts export class HomePage { items = []; constructor(public navCtrl: NavController) { this.initializeItems();} initializeItems() { this.items = [ { 'title':

Angular: forRoot/forChild methods usage?

喜夏-厌秋 提交于 2020-06-10 03:30:54
问题 I was surprised that there is no exact answer to question : What are methods forRoot / forChild made for? For example in RouterModule: Router.forRoot(routes) 回答1: RouterModule#forRoot Creates a module with all the router providers and directives. It also optionally sets up an application listener to perform an initial navigation. While RouterModule#forChild Creates a module with all the router directives and a provider registering routes. The first is usually used to create the initial

Angular 6 - RouterLink navigates but not changing URL

孤街醉人 提交于 2020-05-31 08:06:42
问题 app.component.html <nav> <a routerLink="/dashboard"></a> <a routerLink="/reports"></a> <nav> <main role="main" class="page-container"> <router-outlet></router-outlet> </main> app-routing.module.ts import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { DashboardComponent } from './dashboard/dashboard.component'; import { ReportsComponent } from './reports/reports.component'; const routes: Routes = [ { path: 'dashboard', component: