search

Home  >  Q&A  >  body text

angular.js - How to run functions other than Controller in AngularJS?

For example, there is an event outside an angular controller

$(document).on('getMediaListDone', function(){
          // do something
        }

Then how to trigger this event in angularjs controller?

PHPzPHPz2840 days ago579

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-15 17:02:29

    angular.element(document).triggerHandler('getMediaListDone')
    In older versions of angular, replace triggerHandler with trigger

    reply
    0
  • Cancelreply