Git Product home page Git Product logo

Comments (2)

pkleckner avatar pkleckner commented on June 2, 2024

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.

ofoyer avatar ofoyer commented on June 2, 2024

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-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})
]);


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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.