angular_router 2.0.0-alpha+17

  • Readme
  • Changelog
  • Installing
  • 83

Pub package

The AngularDart router enables navigation from one view to the next as users perform application tasks.

Resources: #

2.0.0-alpha+17 #

New features #

  • RouteDefinition.redirect now supports forwarding route parameters.

2.0.0-alpha+16 #

  • Maintenence release; declare official support for the Dart2 SDK.

2.0.0-alpha+15 #

Breaking changes #

  • Removed component instance parameter from RouterHook.canNavigate().

2.0.0-alpha+14 #

Bug fixes #

  • Preserves NavigationParams on redirection.

  • Added canNavigate to RouterHook.

  • Navigation will no longer succeed for an empty path if it doesn't match a route.

2.0.0-alpha+13 #

New features #

  • Moved normalizePath() from an internal type to Location to give fine-grained control over path normalization.

Bug fixes #

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

2.0.0-alpha+12 #

Breaking changes #

  • Renamed the platformStrategy field of Location to locationStrategy, since it's of type LocationStrategy.

2.0.0-alpha+11 #

New features #

  • Added the method navigateByUrl to Router.

2.0.0-alpha+10 #

Breaking changes #

  • The minimum SDK version is now sdk: ">=2.0.0-dev.46.0 <2.0.0".

Bug fixes #

  • Router navigation requests are now queued to ensure they'll run sequentially in the order they were requested. Previously no attempt was made to synchronise navigation requests, and if multiple were made simultaneously they could run concurrently, interfere with each other, and potentially complete out of order.

2.0.0-alpha+9 #

Breaking changes #

  • APP_BASE_HREF was removed in favor of appBaseHref.

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

Bug fixes #

  • CanNavigate, CanDeactivate, and OnDeactivate should 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.

2.0.0-alpha+8 #

Breaking changes #

  • APP_BASE_HREF is being renamed appBaseHref.

2.0.0-alpha+7 #

Breaking changes #

  • RouterOutlet is no longer injectable.

  • Renamed to Router.onRouteActivated. is now deprecated and will be removed after next release.

Bug fixes #

  • RouterPath.toUrl() no longer generates an incorrect URL with an extra '/' when a parent route has an empty path.

2.0.0-alpha+6 #

New features #

  • Router.onNavigationStart now emits the requested navigation path.

2.0.0-alpha+5 #

New features #

  • Added Router.onNavigationStart to notify subscribers when a navigation request starts.

  • Added the routerProvidersTest module for testing route configurations or components with router dependencies.

Breaking changes #

  • Removed fuzzy arrow from MockLocationStrategy. It relied on Dart 1's treatment of dynamic as bottom to mock handling of popstate events 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.onPopState is now unchanged from LocationStrategy.onPopState.

2.0.0-alpha+4 #

Breaking changes #

  • Removed SpyLocation. MockLocationStrategy should be used instead.

Bug fixes #

  • Prevented 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.

  • Prevented canNavigate() from being invoked twice during redirection.

2.0.0-alpha+3 #

New features #

  • Added the CanNavigate lifecycle interface. This is similar to CanDeactivate, and preferred when the next RouterState isn't necessary to determine whether the router may navigate.

  • Added reload field to NavigationParams which can be used to force navigation, even if the path and other navigation parameters are unchanged.

  • Added replace field to NavigationParams which can be used to replace the current history entry on navigation instead of creating a new one.

Breaking changes #

  • Removed hashCode and operator == overrides from RouteDefinition and RouterState, as these can't be removed by tree-shaking.

Bug fixes #

  • Upon destruction, RouterOutlet will now properly destroy all of its cached components, instead of only destroying the active one.

2.0.0-alpha+2 #

  • Fixed a bug where RouterLinkDirective was not keyboard accessible.

2.0.0-alpha+1 #

  • Support for angular 5.0.0-alpha+1

2.0.0-alpha #

1.0.2 #

  • Support for angular 4.0.0.

1.0.1 #

  • Minor internal changes to support angular 4.0.0-beta

1.0.0 #

  • Initial commit of angular_router. This is just a port of the router that was in the core angular package.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  angular_router: ^2.0.0-alpha+17

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:angular_router/angular_router.dart';
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]
Learn more about scoring.

We analyzed this package on Oct 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: web

Primary library: package:angular_router/angular_router.dart with components: html, js.

Health suggestions

Fix lib/src/location/testing/mock_location_strategy.dart. (-1.99 points)

Analysis of lib/src/location/testing/mock_location_strategy.dart reported 4 hints:

line 38 col 23: Use isNotEmpty instead of length

line 46 col 23: Use isNotEmpty instead of length

line 59 col 9: Use isNotEmpty instead of length

line 62 col 11: Use isNotEmpty instead of length

Fix lib/src/directives/router_outlet_directive.dart. (-1 points)

Analysis of 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.

Fix lib/src/router/router_impl.dart. (-1 points)

Analysis of lib/src/router/router_impl.dart reported 2 hints:

line 240 col 59: This function has a return type of 'Future

line 352 col 9: Use isEmpty instead of length

Fix additional 3 files with analysis or formatting issues. (-1 points)

Additional issues in the following files:

  • lib/src/directives/router_link_active_directive.dart (1 hint)
  • lib/src/router/router.dart (1 hint)
  • lib/src/location/location.dart (Run dartfmt to format lib/src/location/location.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (angular).

Package is getting outdated. (-21.92 points)

The package was last published 63 weeks ago.

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 main.dart, example.dart, and angular_router.dart. Packages with multiple examples should provide example/

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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.64.2 <3.0.0
angular ^5.0.0-beta 5.3.1 6.0.0-alpha+1
collection ^1.14.5 1.14.12
js ^0.6.0 0.6.1+1
meta ^1.1.2 1.1.7
Transitive dependencies
analyzer 0.35.4 0.38.5
angular_ast 0.5.9 0.5.11
angular_compiler 0.4.3 0.4.5
args 1.5.2
build 1.2.0
build_config 0.4.1+1
built_collection 4.2.2
built_value 6.7.1
charcode 1.1.2
checked_yaml 1.0.2
code_builder 3.2.0
convert 2.1.1
crypto 2.1.3
csslib 0.14.6+1 0.16.1
dart_style 1.2.4 1.3.1
fixnum 0.10.9
front_end 0.1.14 0.1.27
glob 1.1.7
intl 0.15.8 0.16.0
json_annotation 3.0.0
kernel 0.3.14 0.3.27
logging 0.11.3+2
matcher 0.12.5
package_config 1.1.0
path 1.6.4
pedantic 1.8.0+1
pub_semver 1.4.2
pubspec_parse 0.1.5
quiver 2.0.5
source_gen 0.9.4+4 0.9.4+5
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.2.0
Dev dependencies
angular_test ^2.0.0-beta
async ^2.0.3 2.4.0
build_runner ^0.9.0
build_test ^0.10.2+5
build_web_compilers ^0.4.0+4
mockito ^3.0.0-alpha
test >0.12.32+1 <2.0.0