javascript - AddEventListener with Angular and remove it -


i needed add event listener angular application. external plugin listening event trigger action.

i did :

$window.addeventlistener('itemloaded', itemloaded, false); 

it works don't find way remove event when change state (i use ui-router).

do know better way angular add event , remove it, if state change ?

thanks help.

if code being called inside of controller, listen $scope.$destroy() event , remove listener when controller unloads.

where calling from?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -