angular2-routing

Angular2 this.route.params.map

故事扮演 提交于 2019-12-10 18:28:55
问题 Angular2 i am lazy loading module and setting up child routes as following in module.ts const routes: Routes = [ { path: '', component: ProgramsComponent}, { path: 'create/:id', component: CreateProgramComponent} ]; here is link utilizing "create" route <a [routerLink]="['create','123']" class="btn btn-primary">New</a> in the receiver component trying to extract id value as following constructor(private route: ActivatedRoute, private programService:ProgramService) { this.route.params .map

rc1 router “No provider for Router”

瘦欲@ 提交于 2019-12-10 18:28:53
问题 This is a follow up post for an error that come after @Shuhei helped me resolved the config.js problem angular 2 rc router angular2-polyfills.js:349 Error This is my app.component.ts import { Component,provide } from '@angular/core'; import { RouteConfig, ROUTER_DIRECTIVES,Router } from '@angular/router-deprecated'; import { HeroShellComponent } from '../apps/hero/hero-shell.component'; import {HomeComponent} from '../home/home.component'; import {Login} from '../login/auth.component'; import

Angular 2 component less routing, executing whatever logic when particular URL is matched and redirect further

ⅰ亾dé卋堺 提交于 2019-12-10 18:25:51
问题 I'm using email service provider to which backend (microservice arhitecture) is sending various details that are needed to populate email dynamically. One of those details are links such as Deposit here link within an email where, when customer clicks on it he should be redirected to app directly to deposit page. How actual link looks like for example is: my-app.com/deposit?accountId=1&customerId=10&something=30 What data is passed to email service provider is: my-app.com/email-redirects?page

Angular Material Dialog not closing after navigation

假如想象 提交于 2019-12-10 17:22:04
问题 I'm working on an application that shows an overview of entities in a datatable. Every entity has linked entities that are shown as 'xxx linked entities' in a column. When the user clicks on the value of that column, a material dialog opens showing the list of the linked entities. These are all links to other entities. Upon clicking one of these links, the correct page of the entity is shown, but the dialog doesn't close. I does close when using the back button. I am using the

Pass route param from parent to child routes

会有一股神秘感。 提交于 2019-12-10 16:18:22
问题 I have routes structured like so: parent/:id | child | child Can I obtain the param from the parent component via: ngOnInit() { this.route.params.subscribe((params) => { this.id = +params['id']; }); } and then just attach it as an input on the <router-output> somehow? Or do I have to pull the value from each child the same way I did the parent? What is the best way to pass the id param from the parent component to all child components? 回答1: Unfortunately, there is no simple way to access

How to make Angular 2 Router work by rewriting the URL in deployed app?

扶醉桌前 提交于 2019-12-10 15:45:37
问题 I'm now finishing my Angular 2 Application and I'm wondering how to host it. I've just tried to build the app on my localhost and actually everything seems to work fine, expect the Router of the app. I can't access routes by rewriting the URL because it's probably looking for some files and .htaccess RewriteRules, rather than routes . It's important for me to be able to access the routes by rewriting the URL, because I don't want to have [routerLink] s for my admin panel and some other stuff

Angular 2 RouterLink for Select

允我心安 提交于 2019-12-10 15:38:10
问题 I would like to create navigation using a select element on my page. Using the RouterLink directive on an anchor tag is simple, but is there an equivalent for a select dropdown? Or am I required to create my own navigation method on my component to be called when there is a change on my select? <a [routerLink]="[location]">Location</a> <select (change)="navigate($event.target.value)"> <option>--Select Option--</option> <option [value]="[location]">Location</option> </select> I am looking for

How to use Angular2 routing

你离开我真会死。 提交于 2019-12-10 15:33:36
问题 I'm trying to write a single-page app but I can't get the routing to work. I tried using many tutorials but they seem to become outdated very quickly, considering that Angular2 is still on beta. It seems that as soon as I add any reference to router directives or router configuration or router providers, the app stops working and the following error is printed on the browser's console: Error: Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:3000/node_modules/angular2/bundles

Angular2 Component does not reinitialize for parameterized route

ぐ巨炮叔叔 提交于 2019-12-10 15:32:55
问题 I have below test route with parameter T1: { path: 'Test/:T1', component: TestComponent }, When I route to 'Test/2' from 'Test/1' my TestComponent does not reinitialize. Is it an issue with angular router? I am using "@angular/router": "3.0.0-beta.1" 回答1: This is currently the only supported behavior. There are plans to make this configurable https://github.com/angular/angular/issues/9811 You can subscribe to parameters change and do the initialization there export class MyComponent {

Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'a'

浪尽此生 提交于 2019-12-10 14:26:25
问题 I am creating a component then it's set to root component then i am getting error Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'a'. i have using RouterLink as a directive in component anotation but it can't work. app.routes.ts import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { dogRoutes } from './Dogs/dog.routes'; import { catRoutes } from './Cats/cat.routes'; import {userRoutes} from ".