angular2-routing

Wiring up Google Maps Nativescript plugin with Angular 2

流过昼夜 提交于 2019-12-02 06:18:55
问题 I'm trying to use the Google Maps plugin for Nativescript (https://github.com/dapriett/nativescript-google-maps-sdk) with Angular 2 and the {N}-Angular router. I have it working in just Nativescript but once I add in Angular 2 and the router I'm failing to get the map to show up in the UI. Since a <Page> tag doesn't go into an Angular2 {N} component template, I can't use the xmlns:maps="nativescript-google-maps-sdk" namespace on the <Page> to instantiate the <maps:mapView> The {N} component

Router directives in two places for same purpose

一个人想着一个人 提交于 2019-12-02 06:14:19
I am having a bit of trouble understanding the logic here root-component import { Component } from "angular2/core"; import { TopNavigationComponent } from "./shared/navigation.component"; import { ArcListComponent } from "./arc/arc-list.component"; import { ArcNewItemComponent } from "./arc/arc-new-item.component"; import { RouteConfig } from "angular2/router"; import { ROUTER_DIRECTIVES } from "angular2/router"; @Component({ selector: "ng2-app", template: ` <section class="jumbotron full-height"> <top-navigation></top-navigation> <div class="container"> <router-outlet></router-outlet> </div>

Passing @Input and subscribing to @Output while navigating to a Route in Angular 2 Component

无人久伴 提交于 2019-12-02 04:49:29
问题 When we navigate to a route and load components, Can we pass variable decorated with @Input in loaded child component and can we subscribe to EventEmitter decorated with @Output ? Is there any lifecycle Hook available in parent, where Route is defined and we may get a reference to loaded component, so as to pass values\subscribe functions to child component dynamically? Parent Component @Component({ moduleId: module.id, selector: "parent", templateUrl: "<router-outlet></router-outlet>" })

Cannot find primary outlet to load 'LocalizationListComponent'

徘徊边缘 提交于 2019-12-02 04:44:50
问题 I am creating an Angular 2 RC5 application and every module is lazy loaded. When the application starts it displays the list from LocalizationListComponent , as intended, but there is a message in the console which says Cannot find primary outlet to load 'LocalizationListComponent' . Considering that the list is displayed and the error complains about the very component is very strange and unusual. In order to resolve this I need to add <router-outlet> together with ROUTER_DIRECTIVES to every

Angular 2 router resolve server request before opening a component

旧时模样 提交于 2019-12-02 04:32:07
问题 I have a BookDetailComponent component which is mapped for an url /books/:id . Is there any way in angular 2 router to make sure that this component is opened only after the Book with given id is retrieved from server? I am looking for similar functionality like ui-router resolve in Angular 2 router. /*** BookComponent ***/ @RouteConfig([ {path: "/books/:id", component: BookDetailComponent, as: "BookDetail"}, ]) export class BookComponent { } /*** BookDetailComponent ***/ export class

Angular: take user to home on clicking browser back button [duplicate]

為{幸葍}努か 提交于 2019-12-02 03:33:53
This question already has an answer here: History push state redirects instead of just pushing new state to browser history 2 answers I want to take the user to the home page when a user clicks on the back button of the browser if the user is in my angular platform. There is an edge case as well which is to be handled, if user has come to our platform via google search, Fb or direct entering link, then we cant this behavior but if he ia already roaming around in our platform then we don't want each back button to take user to home. i.e. User Enter the link and press button => take him to home.

how to show validate message in form in angular 2?

六月ゝ 毕业季﹏ 提交于 2019-12-02 02:52:47
问题 I am trying to show validate message in form in angular 2 ? I am getting this error Cannot read property 'hasError' of undefined I added these lines <div *ngIf="username.hasError('required') && username.touched" class="error-box"> username is required</div> <div *ngIf="username.hasError('minlength') && username.touched" class="error-box"> Minimum password length is 8!</div> here is my code https://plnkr.co/edit/slhySWT0mJXkloGK1kfO?p=preview 回答1: This should do what you want: <ion-input type=

Angular2 Query Parameter from index URL

眉间皱痕 提交于 2019-12-02 01:45:40
问题 I am trying to get the query params from a url in a component in Angular2 Version: "angular2": "npm:angular2@2.0.0-beta.12", I am trying to extract id query param in the component and display it Here is the request. localhost:8080/index.html?id=1 boot.ts import 'reflect-metadata'; import 'angular2/bundles/angular2-polyfills'; import { bootstrap } from 'angular2/platform/browser'; import { provide} from 'angular2/core'; import { AppComponent } from './app.component'; import {ROUTER_PROVIDERS,

Cannot find primary outlet to load 'LocalizationListComponent'

回眸只為那壹抹淺笑 提交于 2019-12-02 01:30:51
I am creating an Angular 2 RC5 application and every module is lazy loaded. When the application starts it displays the list from LocalizationListComponent , as intended, but there is a message in the console which says Cannot find primary outlet to load 'LocalizationListComponent' . Considering that the list is displayed and the error complains about the very component is very strange and unusual. In order to resolve this I need to add <router-outlet> together with ROUTER_DIRECTIVES to every component and view that is affected by this error. The problem with this is that the list will be

Wiring up Google Maps Nativescript plugin with Angular 2

余生颓废 提交于 2019-12-02 01:08:44
I'm trying to use the Google Maps plugin for Nativescript ( https://github.com/dapriett/nativescript-google-maps-sdk ) with Angular 2 and the {N}-Angular router. I have it working in just Nativescript but once I add in Angular 2 and the router I'm failing to get the map to show up in the UI. Since a <Page> tag doesn't go into an Angular2 {N} component template, I can't use the xmlns:maps="nativescript-google-maps-sdk" namespace on the <Page> to instantiate the <maps:mapView> The {N} component basics page gives some guidance but it doesn't work in the ways I've tried: https://docs.nativescript