fix($location): prevent infinite digest error in IE7

Refactored the replacedUrl variable to store the new URL on both
location.replace and setting location.href directly to handle delays in
actual location value change in IE.

Closes #2802