Discussion:
$viewContentLoaded isn't firing
Michael Pateras
2013-04-25 20:38:36 UTC
Permalink
$viewContentLoaded never fires in my Angular controller. The following:

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

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. There
are no javascript errors or warning, and the $scope.$on line is definitely
getting hit (I've set breakpoints to verify). This controller is bound on a
div that is the first child of the ng-view element.

What could cause this?
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Michael Pateras
2013-04-25 21:10:52 UTC
Permalink
Figured it out. MyController was within the view. If I put that code in a
controller outside of the view, it fires properly. What I instead wanted
was includeContentLoaded, as I'm trying to target some included html via
jquery.
Post by Michael Pateras
function MyController($scope){
$scope.$on('$viewContentLoaded', function()
{
alert("blah");
});}
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. There
are no javascript errors or warning, and the $scope.$on line is definitely
getting hit (I've set breakpoints to verify). This controller is bound on a
div that is the first child of the ng-view element.
What could cause this?
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...