$location.search 不会立即更新 [英] $location.search is not updated imediatly

查看:31
本文介绍了$location.search 不会立即更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我的网址在每次设置时都没有更新.它以某种方式与指令相关联,因为在其他情况下它有效.

I have a problem that my url doesn't get updated every time i set it. It is somehow connected with the directive, because in other cases it works.

所以我的问题是,$location.search('dd', val) 依赖什么,它在等待什么,因为函数被调用,但 url 没有更新.

So my question is, on what is the $location.search('dd', val) depended on, what is it waiting for, because function gets called, but the url is not updated.

推荐答案

等待摘要..

$scope.$apply(function() {
   $location.search('dd', val)
})

这篇关于$location.search 不会立即更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆