This construction looks like it relies on knowing the exact URL structure - does `$state.href` not achieve what you want without having to hardcode the '#' ?