The AngularDart router enables navigation from one view to the next as users perform application tasks.
RouterLinkDirective, and the browser location to which it would navigate upon being clicked when using
HashLocationStrategyno longer drops query parameters (before the #) when pushing or replacing an empty URL.
RouteDefinition.redirectnow supports forwarding route parameters.
NavigationParams on redirection.
Navigation will no longer succeed for an empty path if it doesn't match a route.
normalizePath()from an internal type to
Locationto give fine-grained control over path normalization.
Fixed a regression where the
RouterLinkActive directive would not activate
for empty paths (including
Fixed a bug where if a component threw an exception during routing the router would get in a perpetual bad state where it was impossible to route away or otherwise use the application.
locationStrategy, since it's of type
sdk: ">=2.0.0-dev.46.0 <2.0.0".
APP_BASE_HREF was removed in favor of
When navigating to and from the same implementation of
CanReuse, if it
returns true, the implementation will remain attached to the DOM.
Previously, components were unconditionally detached from the DOM on
navigation, and reusable components would simply be reattached.
This may be a change to the scroll behavior of your components, as temporarily removing reused components from the DOM could reset the scroll position if no other content was present.
OnDeactivateshould now always be invoked on the active instance of a component rather than the instance created during route resolution. This previously could occur when navigating away and back to a nested route whose parent was not reusable.
APP_BASE_HREFis being renamed
RouterOutlet is no longer injectable.
Router.stream is now
deprecated and will be removed after next release.
RouterPath.toUrl()no longer generates an incorrect URL with an extra '/' when a parent route has an empty path.
Router.onNavigationStartnow emits the requested navigation path.
Router.onNavigationStart to notify subscribers when a navigation
routerProvidersTest module for testing route configurations or
components with router dependencies.
MockLocationStrategy. It relied on Dart 1's treatment of dynamic as bottom to mock handling of
popstateevents without actually relying on
dart:html. Since Angular must be tested in the browser anyways, there's no incentive to avoid this dependency. As a consequence, the signature of
MockLocationStrategy.onPopStateis now unchanged from
MockLocationStrategyshould be used instead.
canDeactivate() from being invoked twice during redirection. It
will now only be invoked with the redirected next router state, without also
being invoked with the intermediate next router state.
canNavigate() from being invoked twice during redirection.
CanNavigate lifecycle interface. This is similar to
CanDeactivate, and preferred when the next
RouterState isn't necessary
to determine whether the router may navigate.
reload field to
NavigationParams which can be used to force
navigation, even if the path and other navigation parameters are unchanged.
replace field to
NavigationParams which can be used to replace the
current history entry on navigation instead of creating a new one.
operator ==overrides from
RouterState, as these can't be removed by tree-shaking.
RouterOutletwill now properly destroy all of its cached components, instead of only destroying the active one.
RouterLinkDirectivewas not keyboard accessible.
angular_routerpackage. For a migration guide from
angular_routerv1, see https://github.com/dart-lang/angular/blob/master/doc/router/migration.md.
angular_router. This is just a port of the router that was in the core angular package.
Add this to your package's pubspec.yaml file:
dependencies: angular_router: ^2.0.0-alpha+21
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|1.0.2||Aug 30, 2017|
|1.0.1||Aug 24, 2017|
|1.0.0||Aug 7, 2017|
|2.0.0-alpha+23||May 7, 2019|
|2.0.0-alpha+22||Apr 5, 2019|
|2.0.0-alpha+21||Dec 10, 2018|
|2.0.0-alpha+20||Oct 10, 2018|
|2.0.0-alpha+19||Aug 7, 2018|
|2.0.0-alpha+18||Aug 2, 2018|
|2.0.0-alpha+17||Jul 19, 2018|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on May 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: web
lib/src/directives/router_outlet_directive.dart. (-1 points)
lib/src/directives/router_outlet_directive.dart reported 2 hints:
line 123 col 38: 'detectChanges' is deprecated and shouldn't be used.
line 162 col 33: 'detectChanges' is deprecated and shouldn't be used.
lib/src/directives/router_link_active_directive.dart. (-0.50 points)
lib/src/directives/router_link_active_directive.dart reported 1 hint:
line 48 col 29: 'stream' is deprecated and shouldn't be used.
lib/src/router/router.dart. (-0.50 points)
lib/src/router/router.dart reported 1 hint:
line 53 col 47: 'stream' is deprecated and shouldn't be used.
The package description is too short. (-20 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
angular_router.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
Package is pre-release. (-5 points)
Pre-release versions should be used with caution; their API can change in breaking ways.
|Dart SDK||>=2.1.0-dev.5.0 <3.0.0|