2016-11-16 61 views
1

我有下面的代碼角JS重定向查看

程序代碼來渲染/結果內容每當默認視圖功能是使用$航線的

angular.module('myapp').controller 
    ('ResultController',['$route',function ($route){ this.defaultview=function(){$routes._ _ _ _ ('/result');};} 

什麼將在最後一行劃線區域的值稱爲?有什麼建議麼?

+0

我認爲這是有用的,你http://stackoverflow.com/questions/11907961/redirect-using-angularjs –

+0

可能是它的$ location.path ('/ result') – Jigar7521

+0

OP,你使用angular-ui-router嗎?如果不是,請刪除標籤 – nikjohn

回答

0

如果您使用ngRouter,您需要使用$ location。即

在你的情況,你可以使用

$location.path('/result');