$ viewContentLoaded不点火 [英] $viewContentLoaded isn't firing

查看:1457
本文介绍了$ viewContentLoaded不点火的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ viewContentLoaded 从不闪光在我的角度控制器。以下内容:

$viewContentLoaded never fires in my Angular controller. The following:

function MyController($scope)
{
    $scope.$on('$viewContentLoaded', function()
    {
        alert("blah");
    });
}

从未遇到断点,从来没有弹出警报。我认为这是pretty标准使用,所以我不知道它可能是什么,但它绝对不是射击。一切在控制器正常行为。

Never hits a breakpoint, and never pops up the alert. I think this is pretty standard use, so I'm not sure what it could be, but it's definitely not firing. Everything else in the controller is behaving properly.

什么原因呢?

推荐答案

基地您的评论以上,这听起来像你有这样的事情:

Base on your comment above, it sounds like you have something like this:

<ng-view>
   <div ng-controller="MyController"></div>
</ng-view>

我不知道是什么在NG-view标记的内容会做,但 $ viewContentLoaded 发出的从NG-视图范围。这意味着,它只能从 NG-视图,从而控制器永远不会赶上它。上升

I'm not sure what content in the ng-view tag will do, but the $viewContentLoaded is emitted from the ng-view scope. This means, it only goes up from the ng-view and thus your controller would never catch it.

这篇关于$ viewContentLoaded不点火的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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