Hello,

unfortunately, you need to inject $scope to do it.

function MainCtrl(socket, $scope){ ... }



On Tuesday, September 9, 2014 11:57:15 AM UTC-4, Victor Sklyar wrote:
>
> How to handle $destroy event on controller with "controller as" style?
>
> <html ng-app="app">
> <div ng-controller="MainCtrl as main"> {{main.title}}
>
> function MainCtrl(socket) {
>    this.title = "MainCtrl"
>
>    socket.on("event", function(data) {});
>
>    //where $scope.$on("$destroy", ... ) I need call 
> socket.removeAllListener("event")
> }
>
> angular.module("app").controller("MainCtrl", MainCtrl);
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to