angular2-routing

How to set table heading dynamically in angular 2?

◇◆丶佛笑我妖孽 提交于 2020-01-03 01:40:08
问题 I am getting JSON data and I am storing JSON data on my property. this.ResultData_search=data.json().extras.ResultData this.ResultData=[ { "First_name": "xx", "Email": "xxxx", "Phone": "xxx", "countryCode": "+91", "order_datetime": "xxx", "status": 11, "DeviceType": 3, "orderId": "59081a04c9ff6852a49dd32a", "orderseqId": "E00002347", "orderType": 1, "CustomerID": "xx", "pickAddress": "xx", "dropAddress": "xx", "pickLatitude": 17.4369414, "dropLatitude": 17.43673, "dropLongitude": 78

angular 2 rc5 template parse error

房东的猫 提交于 2020-01-02 22:04:15
问题 I keep getting this error when I'm trying to create an angular routing link: zone.js:461 Unhandled Promise rejection: Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'a'. (" </h1> <button (click)="doLogin()">Login</button> <a [ERROR ->][routerLink]="['/createservice']" href="#">Post a Service</a> <router-outlet></router-outlet> "): AppComponent@4:3 ; Zone: <root> ; Task: Promise.then ; Value: BaseExceptionconsoleError @ zone.js:461 zone.js:463 Error:

Authentication in Angular 2, handling the observables

家住魔仙堡 提交于 2020-01-02 20:11:18
问题 I just started with a Angular 2 project and am trying to get authentication up and running. Inspired by this tutorial I decided to do the following: Create a custom RouterOutlet class (extending it) to handle the authentication logic whenever a url is called. I succeeded in this custom class, but am still not sure how to check if a user is authenticated. My situation is as follows, I need to query a get call to a external API, for my development proces it is as follows: getAdmin() { let

Authentication in Angular 2, handling the observables

安稳与你 提交于 2020-01-02 20:11:15
问题 I just started with a Angular 2 project and am trying to get authentication up and running. Inspired by this tutorial I decided to do the following: Create a custom RouterOutlet class (extending it) to handle the authentication logic whenever a url is called. I succeeded in this custom class, but am still not sure how to check if a user is authenticated. My situation is as follows, I need to query a get call to a external API, for my development proces it is as follows: getAdmin() { let

How to navigate in angular2 to new tab

可紊 提交于 2020-01-02 07:57:43
问题 Is there a parameter to provide to the router so that router.navigate() will open in a new tab/window in browser? 回答1: Create routes just like instructed here. Set up your app-routing.module.ts ( or just put it in app.module.ts ), place the <router-link> in your app.component.html . Now, to open a new window from the main page, ( or whatever sub-routes you have created ) just call a function, handled in the main component, that will point to the url of the sub-component route that you setup

Angular 2 new router routerCanReuse

懵懂的女人 提交于 2020-01-02 07:27:28
问题 In the new Angular 2 router, they have removed the CanReuse interface. Is there a way to achieve this functionality (force component reload) with another feature of the router? 回答1: Now there's RouteReuseReuse strategy, which you can replace with your own, if you want to re-render the route on navigation, you can do it like this 1.Define Custom Strategy (this strategy works just like the old-router) export class CustomReuseStrategy implements RouteReuseStrategy { shouldDetach(route:

angular 2 testing w/router

断了今生、忘了曾经 提交于 2020-01-02 07:04:58
问题 I have a component and when a user logs in it routes to a url called /dashboard I am really struggling figuring out why I am getting the following error. cannot read property 'args' of undefined I have been following the official docs on testing with router found here https://angular.io/docs/ts/latest/guide/testing.html#!#routed-component but it doesnt seem to help. Half my problem is I dont quite understand all the code in the doc. Here is my unit test for the route beforeEach(async(()=>{

Angular2 add class when route is inactive

南楼画角 提交于 2020-01-02 05:29:08
问题 Angular2 has a routerLinkActive directive which adds class to the element if the route is active. I want to add a class when route is inactive . Is there a way to do this? 回答1: <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive" [ngClass]="rla.isActive ? 'classIfActive' : 'classIfNotActive'"> </a> 来源: https://stackoverflow.com/questions/41982000/angular2-add-class-when-route-is-inactive

Angular 2 routing raising 404 errors

倖福魔咒の 提交于 2020-01-01 15:48:18
问题 HTML5 PushState means refresh URL or enter direct URL in browser works perfectly fine when I run my angular app using 'npm start' command from VS 2015 command prompt. However when I deploy same application on IIS and change <base href="/"/> to <base href="/MyVirtualApplication/" /> then HTML5's PushState or History API doesn't work properly and raising 404 error. Please do suggest. 回答1: EDIT : IIS Setup for Url Rewriting: You need to install this to make the following work: http://www.iis.net

Angular 2 routing raising 404 errors

自作多情 提交于 2020-01-01 15:48:12
问题 HTML5 PushState means refresh URL or enter direct URL in browser works perfectly fine when I run my angular app using 'npm start' command from VS 2015 command prompt. However when I deploy same application on IIS and change <base href="/"/> to <base href="/MyVirtualApplication/" /> then HTML5's PushState or History API doesn't work properly and raising 404 error. Please do suggest. 回答1: EDIT : IIS Setup for Url Rewriting: You need to install this to make the following work: http://www.iis.net