<bdo id='Qktrc'></bdo><ul id='Qktrc'></ul>
  1. <i id='Qktrc'><tr id='Qktrc'><dt id='Qktrc'><q id='Qktrc'><span id='Qktrc'><b id='Qktrc'><form id='Qktrc'><ins id='Qktrc'></ins><ul id='Qktrc'></ul><sub id='Qktrc'></sub></form><legend id='Qktrc'></legend><bdo id='Qktrc'><pre id='Qktrc'><center id='Qktrc'></center></pre></bdo></b><th id='Qktrc'></th></span></q></dt></tr></i><div id='Qktrc'><tfoot id='Qktrc'></tfoot><dl id='Qktrc'><fieldset id='Qktrc'></fieldset></dl></div>

  2. <legend id='Qktrc'><style id='Qktrc'><dir id='Qktrc'><q id='Qktrc'></q></dir></style></legend>
  3. <tfoot id='Qktrc'></tfoot>
  4. <small id='Qktrc'></small><noframes id='Qktrc'>

    1. 调用后在 angularjs 中解绑 $watch

      Unbinding $watch in angularjs after called(调用后在 angularjs 中解绑 $watch)

      <small id='cr4ar'></small><noframes id='cr4ar'>

        • <bdo id='cr4ar'></bdo><ul id='cr4ar'></ul>

            <legend id='cr4ar'><style id='cr4ar'><dir id='cr4ar'><q id='cr4ar'></q></dir></style></legend>

              <tfoot id='cr4ar'></tfoot>
                  <tbody id='cr4ar'></tbody>
              • <i id='cr4ar'><tr id='cr4ar'><dt id='cr4ar'><q id='cr4ar'><span id='cr4ar'><b id='cr4ar'><form id='cr4ar'><ins id='cr4ar'></ins><ul id='cr4ar'></ul><sub id='cr4ar'></sub></form><legend id='cr4ar'></legend><bdo id='cr4ar'><pre id='cr4ar'><center id='cr4ar'></center></pre></bdo></b><th id='cr4ar'></th></span></q></dt></tr></i><div id='cr4ar'><tfoot id='cr4ar'></tfoot><dl id='cr4ar'><fieldset id='cr4ar'></fieldset></dl></div>
              • 本文介绍了调用后在 angularjs 中解绑 $watch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我知道你可以像这样解除 $watch 的绑定:

                I know you can unbind a $watch like this:

                var listener = $scope.$watch("tag", function () {});
                // ...
                listener(); // would clear the watch
                

                但是你可以在 watch 函数声明中取消绑定手表吗?那么在手表执行一次之后,它会自行解除绑定吗?比如:

                but can you unbind the watch within the watch function declaration. So after the watch gets executed once, it unbinds itself? Something like:

                $scope.$watch("tag", function () {
                    unbindme()
                });
                

                推荐答案

                你可以像你已经做的那样做,在你的函数中调用取消注册":

                you can just do it the same way you already do, call the "deregistration" inside your function:

                var unbind = $scope.$watch("tag", function () {
                    // ...
                    unbind();
                });
                

                这篇关于调用后在 angularjs 中解绑 $watch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
                • <bdo id='DFrmK'></bdo><ul id='DFrmK'></ul>
                    <legend id='DFrmK'><style id='DFrmK'><dir id='DFrmK'><q id='DFrmK'></q></dir></style></legend>

                        <small id='DFrmK'></small><noframes id='DFrmK'>

                          <tfoot id='DFrmK'></tfoot>
                          <i id='DFrmK'><tr id='DFrmK'><dt id='DFrmK'><q id='DFrmK'><span id='DFrmK'><b id='DFrmK'><form id='DFrmK'><ins id='DFrmK'></ins><ul id='DFrmK'></ul><sub id='DFrmK'></sub></form><legend id='DFrmK'></legend><bdo id='DFrmK'><pre id='DFrmK'><center id='DFrmK'></center></pre></bdo></b><th id='DFrmK'></th></span></q></dt></tr></i><div id='DFrmK'><tfoot id='DFrmK'></tfoot><dl id='DFrmK'><fieldset id='DFrmK'></fieldset></dl></div>

                            <tbody id='DFrmK'></tbody>