$location.hash()

hash([hash]);

This method is getter / setter.

Returns the hash fragment when called without any parameters.

Changes the hash fragment when called with a parameter and returns $location.

// given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
var hash = $location.hash();
// => "hashValue"

Parameters

Param Type Details
hash
(optional)
stringnumber

New hash fragment

Returns

string

hash

doc_AngularJS
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.