I am testing with the following AngularJS $location. I don't what's the problem with this. Just want to check if the redirection is working or not:
HTML
<body data-ng-controller="MainCtrl">
Hello {{name}}!
<button ng-click='go()'>Go</button>
</body>
AngularJS code
var app = angular.module('location', []);
app.controller('MainCtrl', function($scope,$routeParams, $location) {
$scope.name = 'World';
$scope.go = function() {
$location.absUrl() = 'http://www.google.com';
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…