Driver instances in AngularJS

0

Good morning, what happens is the following:

In my controller "MessageListCtrl" I have a $ interval, which makes certain updates every certain time.

I also have the $ routeProvider that handles the following:

        }).when('/label/:labelId', {
            templateUrl: 'public/partials/message/list.html',
            controller: 'MessageListCtrl'

Likewise, I have a menu with several sub-menus, each one with its respective identifier and which calls the previous $ routeProvider.

My problem is that by choosing the different sub-menus, and calling "/ label / 1", "/ label / 2", etc. Instances of the "MessageListCtrl" controller are created, and also new $ interval, without which I can destroy the previous one. The expected thing would be to create a single instance and every time you call that controller the previous $ interval is closed, and thus start a new one.

The previous thing I could handle it when calling "MessageListCtrl" from another controller "XYZ", but not in the case described above.

I hope you can share some experience. Thanks.

    
asked by user62469 10.10.2017 в 02:58
source

0 answers