I am trying to update angular2 to latest version. Several of the functions are missing
I would like to know what is the alternate for the following function
final RouteParams _params;
String get routeName => _router.currentInstruction.component.routeName;
How to get routeName from new AngularDart
Not possible to access current component route anymore.
I don't know what you want to do exactly and how you define your routeName, but you probably need to use additionalData
of RoutePath
or RouteDefinition
class AdditionalRouteData {
final String routeName;
const AdditionalRouteData({this.routeName});
}
final routePath = RoutePath(
path: '/',
additionalData: AdditionalRouteData(routeName: 'Home'),
);
// then get it that way
(router.current.routePath.additionalData as AdditionalRouteData).routeName;
However, if your routeName is dynamic, you must find a new way to access it (without the router, using a service via dependency injection)