Router class abstract
The Angular router, which is represented as a stream of state changes.
In order to be notified when navigation is occurring listen to the stream:
class MyComponent implements OnInit {
final Router _router;
MyComponent(this._router);
@override
void ngOnInit() {
_router.onRouteActivated.listen((newState) {
print('Navigating from ${_router.current} to $newState');
});
}
}
Constructors
- Router()
Properties
- current → RouterState?
-
Current state of the router.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
Emits the requested path when navigation starts.
no setter
-
onRouteActivated
→ Stream<
RouterState> -
Emits the next router state after a new route is activated.
no setter
-
onRouteResolved
→ Stream<
RouterState> -
Emits the potential change to the router state once the a new route is
resolved.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
RouterState> -
no setter
Methods
-
Attempts to navigate to a route that matches
path
. -
Attempts to navigate to a route that matches
url
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerRootOutlet(
RouterOutlet routerOutlet) → void -
Registers the root
routerOutlet
and navigates to the current route. -
toString(
) → String -
A string representation of this object.
inherited
-
unregisterRootOutlet(
RouterOutlet routerOutlet) → void -
Unregisters the root
routerOutlet
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited