0
我使用$location.path('www.google.com');
打開外部鏈接,但是網址不被覆蓋所以它帶我去定義,否則URL中app.js
如何將頁面重定向到angularjs中的外部網址?
我也用$window.open
,但它沒有做任何事情。
如何打開外部鏈接,最好在新選項卡中打開?
myApp.service('GetUrl', ['$http', '$window', function ($http, $window) {
this.ToUrl = function(file, url){
$http.post('/geturl')
.success(function(respond){
//I'm getting respond as https://demo.docusign.net/
window.open(respond); //this is were I have performed redirection here server sends the response but window.open or $window.open is not performing anything it just stays in the same page
})
.error(function(){
});
}
}]);
使用'window.open(「http://www.google.com」);' – Sunand 2014-09-04 19:25:53
不,不工作。 – jyoti 2014-09-04 19:30:02
你能用你正在使用的代碼更新你的問題嗎?使用'window.open()'確實有效,但如果它在你的應用程序中不起作用,那麼我們需要查看該代碼才能知道原因。 – 2014-09-04 19:35:01