I'am trying to get paramter from url like that:
index.html#!/forum/page?1-something
the number that what i'am trying to get
both $location.url(); and $location.absUrl(); get the whole url
do I have to use split and how to do that?
Using $location.search() you can get all query parameters. by iterating an object you can get all key and value as well.
I used to iterate object using for-in loop. here $location.search() is an object itself so you can iterate it as:
for(let key in $location.search()){
console.log("key: "+key+" value: "+$location.search()[key]);
}
we can also append query parameters using $location.search() by just passing parameters to it. this can be done as:
let obj = {site:'stack overflow', exp: 'happy coding'}
and this obj object can be passed to $location.search() as:
$location.search(obj);
#is the hash