angular2-router3

angular2 and routing - adding a query parm to child

浪尽此生 提交于 2020-01-05 05:39:06
问题 Wow this.router.navigate(['/services', {outlets: {'servicelistright': ['servicelist']}}]); If I the below to the url I get get the query parm using the below: http://localhost:4200/#/services/(servicelistright:servicelist;type=11) this.route.params.map(params => params['type']) .subscribe(type => { console.log('stupid',type) }); Well I think is just wonderful..wow great... But how on earth do I add the query parm? 1) by using router.navigate this.router.navigate(['/services', {outlets: {

Error: No component factory found for TermsConditions

走远了吗. 提交于 2020-01-04 09:04:10
问题 I am getting this Error: No component factory found for TermsConditions while using angular2-rc6. My route map is like this: { path: '', component: TermsConditions } 回答1: Thanks for your help. I got to know how to fix this issue. No component factory found for TermsConditions. @NgModule({ declarations : [ TermsConditionsComponent ] }) export default class TermsConditions {} Import this module to your root module. @NgModule({ declarations : [ AppComponent ], imports: [ BrowserModule,

What are Router Bindings actually used for

拜拜、爱过 提交于 2020-01-03 07:00:08
问题 What are Router Bindings actually used for in Angular2 router. specially the Router 3.0 (newest Angular RC4 router)? Any working code or plunker? https://angular.io/docs/ts/latest/api/router-deprecated/index/ROUTER_BINDINGS-let.html 回答1: The name was just changed from ROUTER_BINDINGS to ROUTER_PROVIDERS as were the bindings parameter of the @Component() , @Directive() or @Pipe() decorator was renamed to providers and they actually are the router implementation and services provided by the

LoggedInOutlet angular2 authentication - Router v3.0.0-alpha8 - Where is ComponentInstruction?

房东的猫 提交于 2019-12-31 03:17:22
问题 I am using code like this to extend RouterOutlet and create app wide authentication and route protection import {Directive, Attribute, ViewContainerRef, DynamicComponentLoader} from '@angular/core'; import {Router, ComponentInstruction} from '@angular/router'; import {Router} from '@angular/router'; import {RouterOutletMap} from '@angular/router/src/router_outlet_map'; import {RouterOutlet} from '@angular/router/src/directives/router_outlet'; import {Authentication} from '../common

LoggedInOutlet angular2 authentication - Router v3.0.0-alpha8 - Where is ComponentInstruction?

你。 提交于 2019-12-31 03:17:09
问题 I am using code like this to extend RouterOutlet and create app wide authentication and route protection import {Directive, Attribute, ViewContainerRef, DynamicComponentLoader} from '@angular/core'; import {Router, ComponentInstruction} from '@angular/router'; import {Router} from '@angular/router'; import {RouterOutletMap} from '@angular/router/src/router_outlet_map'; import {RouterOutlet} from '@angular/router/src/directives/router_outlet'; import {Authentication} from '../common

Return Observable in canDeactivate not working

谁说胖子不能爱 提交于 2019-12-29 07:51:19
问题 I have a confirm/cancel modal dialog that pops up when a user leaves a route. I do this by using a guard with the canDeactivate method. However I want canDeactivate to wait until it gets a response from the modal before returning anything. I have tried to do this by returning an observable but it is not working. canDeactivate(): Observable<boolean> | boolean { if(this.isFormStarted()) { this.formService.showExitModal(true); return this.formService.getModalSelectionObservable(); } else {

How to specify auxiliary component for child route in angular2 router3

≯℡__Kan透↙ 提交于 2019-12-21 06:24:13
问题 I am using the new route3 and would like to know what is the URL syntax to specify a auxiliary component for a child route. I have following child route definition: const router: RouterConfig = [ { path: 'component-c', component: ComponentC, children: [ { path: 'auxPath', component: ComponentAux, outlet: 'aux'}, { path: 'c1', component: ComponentC1 } ] } ]; And the template for ComponentC is like @Component({ selector: 'component-c', template: ` <div>Child Route Component</div> <router-outlet

How to specify auxiliary component for child route in angular2 router3

血红的双手。 提交于 2019-12-21 06:24:05
问题 I am using the new route3 and would like to know what is the URL syntax to specify a auxiliary component for a child route. I have following child route definition: const router: RouterConfig = [ { path: 'component-c', component: ComponentC, children: [ { path: 'auxPath', component: ComponentAux, outlet: 'aux'}, { path: 'c1', component: ComponentC1 } ] } ]; And the template for ComponentC is like @Component({ selector: 'component-c', template: ` <div>Child Route Component</div> <router-outlet

How can I specify query parameters by routerLink directive

这一生的挚爱 提交于 2019-12-19 17:45:32
问题 I am experimenting the new router (version 3.0.0-alpha.7) and would like to know how to specify query parameters by routerLink directive? The Router.navigate() method below generates a URL like http://localhost:3000/component-a?x=1 this.router.navigate(['/component-a'], {queryParams: {x: 1}}); However, I can't figure out how to do the same thing with the routerLink directive. Template like below returns parser error... <a [routerLink]="['/component-a'], {queryParams: {x: 1}}">Component A</a>

No provider for ActivatedRoute - Angular 2 RC5

為{幸葍}努か 提交于 2019-12-18 07:30:24
问题 After upgrading to Angular 2 RC5 (from RC4) it seems I can no longer inject ActivatedRoute into my components. ORIGINAL EXCEPTION: No provider for ActivatedRoute! Here's the relevant piece of code: import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; declare var module: { id: string; }; @Component({ moduleId: module.id, selector: 'mds-app', templateUrl: 'app.component.html', styleUrls: [ 'app.component.css' ], directives: [] }) export class AppComponent