【发布时间】:2017-08-02 03:01:20
【问题描述】:
我想知道当我在此处使用此 Pubnub 函数时如何路由到不同的视图。
队列控制器
Pubnub.hereNow(
{
includeUUIDs: true,
includeState: true
},
function (status, response){
console.log(response);
//do some algorithm with response
$location.path('/chat');
}
);
所以基本上我是从这个hereNow 函数中获取response,然后当算法通过内部条件时,我希望它从我的QueueController 转到我的ChatController,这样用户就可以开始聊天了!我什至从函数中删除了算法,并且只拥有路由,但它根本不起作用。
当我将$location.path('/chat') 放在我的hereNow 函数之外 时,它的路由非常好。
那么在这种情况下,如何路由到不同的视图?
【问题讨论】:
-
我认为你需要在函数中将 $location 作为参数传递,然后它才能工作
-
你好 Ghulam 谢谢你的回答!
-
我的荣幸:)