angular2-routing

Angular 4 unit test - Cannot read property 'root' of undefined

谁说胖子不能爱 提交于 2019-12-11 05:44:43
问题 I've got a problem with my unit test. I don't know what's wrong with this test. I've searched a soulations but nothing works for me. When I want to mock Router I have an error TypeError: Cannot read property 'root' of undefined . Thanks in advace for any help. Error: TypeError: Cannot read property 'root' of undefined at rootRoute (webpack:///~/@angular/router/@angular/router.es5.js:5880:0 <- src/test.ts:53760:30) at DynamicTestModuleInjector.get (ng:///DynamicTestModule/module.ngfactory.js

Angular 2 rc5 router match X subcategories

心不动则不痛 提交于 2019-12-11 05:09:57
问题 Using the new router in Angular 2 rc5 and have a common route I'm unsure how to write. I need an url that's something like: http://localhost:3000/store/{category}/{product-name} This seems simple enough until I add in that I'm looking for there to be potentially multiple sub categories like (without us knowing how many there possibly are): http://localhost:3000/store/{category 1}/{sub category 2}/{sub category 3}..../{product-name} How can i create a path that matches against both the sub

Angular2 Router and Express Integration

若如初见. 提交于 2019-12-11 04:37:26
问题 I'm having a problem using the Angular2 router and express, but none of the previous questions seem to have the solution I need. I'm using the latest version of the angular2-cli. When I direct my browser to localhost:3000, I get the generic "app works" message that the angular2-cli generates. My problem arises when I try to navigate to one of my child routes, such as localhost:3000/auth/login - it redirects me back to the same "app works" page, instead of showing me a page that says "login

Angular2 : Multiple Router-Outlets & Router-Outlets Inside Child Route

我是研究僧i 提交于 2019-12-11 04:14:08
问题 I have created an application containing a left-navigation (containing "User Management", "Vehicle Management" and "Administration"). The routing to go to the respective Components currently works as follows: /user opens the User-Component /vehicle opens the Vehicle-Component /admin opens the Admin Home-Component On clicking "Administration", a top-menu must be displayed to control navigation to Admin-Home-Component, User-Admin-Component and Vehicle-Admin-Component. I was able to do this by

Can Angular 2 parse links received from external CMS to be resolved as internal

独自空忆成欢 提交于 2019-12-11 02:57:44
问题 We are working on a decoupled project with Drupal as our backend and Angular as our front-end. Everything is nearing completion but certain (dynamic, as in created in Drupal) pages require links to different pages of the angular app. For example: An editor creates an FAQ question in Drupal with an answer containing a link to the Pricing page of the angular app. (Q: How much does this service cost? A: Check out our [pricing] page) User on frontend opens FAQ page Angular loads our FAQ page

Why ngOnInit is getting called every time repeatedly

青春壹個敷衍的年華 提交于 2019-12-11 02:29:03
问题 Per Angular ( https://angular.io/api/core/OnInit that says ngOnInit is called right after the directive's data-bound properties have been checked for the first time, and before any of its children have been checked. It is invoked only once when the directive is instantiated . ), So ngOnInit should be called once, but as shown in the plunker ( that is a copy from https://angular.io/tutorial/toh-pt5 ) , I only modified app/heroes/heroes.component.ts and app/dashboard/dashboard.component.ts to

Why do I have @angular/core in node_modules, but still get this error?

这一生的挚爱 提交于 2019-12-11 02:09:15
问题 I downloaded an example project from angular.io , from here https://angular.io/generated/zips/cli-quickstart/cli-quickstart.zip and ran npm install in the root folder, as in this tutorial https://www.youtube.com/watch?v=bJKejcQJqHE and somewhy, although I have the corresponding angular packages in both node_modules and package.json, still I got this: Hash: faeff28da7a6ba00851d Time: 8547ms chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {4} [initial] [rendered] chunk

Meteor JS Routing on Angular 2 Tutorial doesn't work

纵然是瞬间 提交于 2019-12-11 02:08:55
问题 I'm trying to make the socially tutorial from the meteor js web but I'm stuck on the step 5 Routing & Multiple Views When I click on the link to see "party details" the javascript console says that the route doesn't exists. This is the code from the view that has the link. <a [routerLink]="['/party', party._id]">{{party.name}}</a> And this is the code from the routes: const routes: RouterConfig = [ { path: '', component: PartiesListComponent }, { path: 'party/:partyId', component:

Nested Routes in Angular 2 with release candidate Component Router

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 01:45:12
问题 I was building a simple application where someone can search for a user by email in a form and then see the various pieces of data associated with that user. For the top AppComponent component I have the followings routes: @Routes([ {path: '/:name', component: CustomerComponent}, {path: '/search', component: SearchComponent} ]) The search path corresponds to the form to search for a customer and the /:name path is intended to be for displaying the data for that customer. My idea was to have

How to configure Google App Engine yaml file to handle 404 Error

主宰稳场 提交于 2019-12-11 01:44:28
问题 Need to redirect all 404 links to index.html inside www folder This is my app.yaml runtime: python27 api_version: 1 threadsafe: true handlers: - url: / static_files: www/index.html upload: www/index.html - url: /(.*) static_files: www/\1 upload: www/(.*) It's a static angular 2 app , and i need to direct all page not found 404 errors to index.html. There is (www) folder and inside that all file including index.html there. 回答1: So adding this as the last rule, will cause it to serve index.html