HashLocationStrategy class
HashLocationStrategy
is a LocationStrategy used to configure the
PlatformLocation service to represent its state in the
hash fragment
of the browser's URL.
For instance, if you call location.go('/foo')
, the browser's URL will become
example.com#/foo
.
Example
import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';
@Component(
// Should only be provided at the root.
providers: [
routerProvidersHash,
],
)
class AppComponent {
AppComponent(Location location) {
location.go('/foo');
}
}
- Inheritance
-
- Object
- LocationStrategy
- HashLocationStrategy
- Annotations
-
- @Injectable()
Constructors
- HashLocationStrategy(PlatformLocation _platformLocation, [@Optional() @Inject(appBaseHref) String? baseHref])
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
back(
) → void -
override
-
forward(
) → void -
override
-
getBaseHref(
) → String -
override
-
hash(
) → String -
Creates a combined hash code for a number of objects.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onPopState(
EventListener fn) → void -
override
-
path(
) → String -
override
-
prepareExternalUrl(
String internal) → String -
override
-
pushState(
Object? state, String title, String path, String queryParams) → void -
override
-
replaceState(
Object? state, String title, String path, String queryParams) → void -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited