Call external js file function in Angular js controller

后端 未结 5 1977
挽巷
挽巷 2021-02-18 20:42

I have the external js file which has more functions.

I need to call these functions from angular controller.

For example: external.js



        
5条回答
  •  时光取名叫无心
    2021-02-18 21:00

    As mentioned by @nilsK, you define a self invoking function. And then reference to it via window object. For example -

    (function functionName(){
        Do Something Here...
    })();
    

    And then,

    window.functionName();
    

    And if your are using AngularJS,

    $window.functionName();
    

提交回复
热议问题