angular - angular2 - ROUTER_PROVIDERS is not defined -
i have code in system.config.js when comes importing angular2's old router (the deprecated one).
'@angular/router-deprecated': 'npmcdn:@angular/router-deprecated@'+angularversion,
i'm getting error:
system.src.js:43 uncaught (in promise) error: router_providers not defined(…)
this plunkr here
how can fix this?
your plunker has several problems.
at app/index.ts
:
add imports:
import { router_providers } '@angular/router-deprecated'; import { hashlocationstrategy, locationstrategy } '@angular/common'; import { provide } '@angular/core';
not mandatory, should remove
.ts
extension:import { app } './app2.ts';
should be:
import { app } './app2';
at app/home.ts
add path
templateurl
:templateurl: './home.html'
becomes:
templateurl: './app/home.html'
at app/add_developer.ts
also add path
templateurl
:templateurl: './add_developer.html'
becomes:
templateurl: './app/add_developer.html'
general: update *ngfor
notation
consider updating
*ngfor
notation latest. using in several places. uselet
instead of#
. instance, @app/home.html
:<tr *ngfor="#dev of getdevelopers()">
should be
<tr *ngfor="let dev of getdevelopers()">
click here updated plunker (including *ngfor
changes).
Comments
Post a Comment