RouteData
is an immutable map of additional data you can configure in your
Route
.
You can inject RouteData
into the constructor of a component to use it.
Example
import 'package:angular2/angular2.dart'; import 'package:angular2/platform/browser.dart'; import 'package:angular2/router.dart';
@Component(directives: ROUTER_DIRECTIVES
)
@RouteConfig(const
{'path': '/user/:id', 'component': UserCmp, 'name': 'UserCmp',
'data': {'isAdmin': true}},
)
class AppCmp {}
@Component( ..., template: 'user: {{isAdmin}}' ) class UserCmp { String isAdmin; UserCmp(RouteData data) {
isAdmin = data.get('isAdmin');
} }
bootstrap(AppCmp, ROUTER_PROVIDERS);
Constructors
- RouteData([Map<String, dynamic> data = const {} ])
-
const
Properties
- data → Map<String, dynamic>
-
read-only
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
get(
String key) → dynamic -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited