Apply CSS to active router link [Angular 2]

后端 未结 3 1708
面向向阳花
面向向阳花 2021-01-18 10:34

I would like to apply special CSS style properties to active router links:

3条回答
  •  遥遥无期
    2021-01-18 11:29

    The new router has a directive called "routerLinkActive" which is what your interested in.

    Ex.Bob

    "When the url is either '/user' or '/user/bob', the active-link class will be added to the a tag. If the url changes, the class will be removed."

提交回复
热议问题