javascript - SmartyStreets jQuery.liveaddress plugin, how to unbind events -


i'm using smarty streets jquery.liveaddress plugin in angular single page app. need unbind of event listeners liveaddress instance when transition next page. right now, if come page, events fired twice, next time on page, 3 times.

i've tried can think of. last solution unbind of event names $(document) because looks plugin attaching of events to. didn't work.

jquery(document).unbind("addresschanged");         jquery(document).unbind("autocompleteused");         jquery(document).unbind("verificationinvoked");         jquery(document).unbind("requestsubmitted");         jquery(document).unbind("responsereceived");         jquery(document).unbind("requesttimedout");         jquery(document).unbind("addresswasvalid");         jquery(document).unbind("addresswasambiguous");         jquery(document).unbind("addresswasinvalid");         jquery(document).unbind("addresswasmissingsecondary");         jquery(document).unbind("originalinputselected");         jquery(document).unbind("usedsuggestedaddress");         jquery(document).unbind("invalidaddressrejected");         jquery(document).unbind("addressaccepted");         jquery(document).unbind("completed"); 

ok trying implement smartystreets jquery.liveaddress plugin in angular application.

the trick not register anonymous event handlers.

in case instantiating smartystreets in directive, put eventhandlers on scope , call liveaddress.deactivate() upon $destroy. no more duplicate events.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -