Comments (2)
I think you are confusing ROUTER_PROVIDERS
and ROUTER_DIRECTIVES
. If I understand it correctly, ROUTER_PROVIDERS
initializes navigation between pages (which is required once in boot.ts
), and ROUTER_DIRECTIVES
is used anytime you would use RouterLink
or RouterOutlet
.
Yeah, it's a pain. But there seem to be some work arounds:
http://stackoverflow.com/questions/35878966/router-directives-in-two-places-for-same-purpose
Obviously adding it everytime you're using either of one of them is annoying, so you can make it simpler by using PLATFORM_DIRECTIVES. This way you'll add it once in your application and it will be available across of it.
bootstrap(App, [
provide(PLATFORM_DIRECTIVES, {useValue: [ROUTER_DIRECTIVES], multi: true})
]);
Added:
It appears that this may become a thing built right into Angular:
angular/angular#5938
from angular2-course.
Hi Patrick,
Thank you so much for your help !!!
Best regards,
Ori
On Wed, Sep 28, 2016 at 6:15 AM, Patrick Kleckner [email protected]
wrote:
I think you are confusing ROUTER_PROVIDERS and ROUTER_DIRECTIVES. If I
understand it correctly, ROUTER_PROVIDERS initializes navigation between
pages (which is required once in boot.ts), and ROUTER_DIRECTIVES is used
anytime you would use RouterLink or RouterOutlet.Yeah, it's a pain. But there seem to be some work arounds:
http://stackoverflow.com/questions/35878966/router-
directives-in-two-places-for-same-purposeObviously adding it everytime you're using either of one of them is
annoying, so you can make it simpler by using PLATFORM_DIRECTIVES. This way
you'll add it once in your application and it will be available across of
it.bootstrap(App, [
provide(PLATFORM_DIRECTIVES, {useValue: [ROUTER_DIRECTIVES], multi: true})
]);—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL6gXl6yClQaHvSjA-_qApHbiKtkc_vZks5qudu4gaJpZM4KHvN4
.
from angular2-course.
Related Issues (18)
- I get the below error HOT 6
- Favorite Icon Exercise Issue HOT 2
- Lecture 81: I get: [ts] 'Promise' only refers to a type, but is being used as a value here HOT 1
- Lecture 93 - Observables - I get an npm start error - Failed at the [email protected] start script 'concurrent "npm run tsc:w" "npm run lite" '. Tell the author that this fails on your system: concurrent "npm run tsc:w" "npm run lite" HOT 2
- For lecture 120 - Route Parameters, how come we did not add RouteParams to the provider property? As it is a dependency.
- Angular2 Final Project:Form validation messages not displaying
- Update the user-form.component.html to work with Angular 4.1.1
- Trying to get this stuff going..
- Auth0 router is not provided
- Upgrade the projec to Angular 2 RC1. "-" error
- Local workspace file ('angular.json') could not be found. HOT 1
- basicValidators.ts HOT 3
- issue with creating component from command prompt. HOT 3
- please update config files to final release of angular2 HOT 4
- start command in package.json HOT 1
- Error during evaluation of "click"
- typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-course.