2016-11-16 82 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');