Skip to content

Router: Provide method to check if route is active #9446

Closed
@brandonroberts

Description

@brandonroberts

I'm submitting a ... (check one with "x")

[ ] bug report
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

There isn't a public API to see if a UrlTree is contained within the current router UrlTree

Expected/desired behavior

Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).

What is the expected behavior?

Provide some method such as isActive(tree: UrlTree, exact: boolean): boolean to check if the current UrlTree contains the provided UrlTree.

What is the motivation / use case for changing the behavior?

Being able to manually check if a route is active

Please tell us about your environment:

  • Angular version: 2.0.0-rc.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5 | Dart]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions