Why is 'window.angular' used like so, in this function definition?

前端 未结 1 1548
遇见更好的自我
遇见更好的自我 2021-02-06 05:11

I\'m trying to understand an angularjs file I need to use to integrate with Django, and it has a weird syntax I\'m not familiar with (bear in mind I\'m a junior dev, so this may

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 05:56

    window.angular is the global angularjs variable which is created once angularjs has been fully loaded from a script tag. The code fragment you have pasted ensures that it is executed after the population of this variable. One reason it might be written in that verbose way is simply its auto-generated nature. In a wider context, it may have implication to the order in which scripts are executed or to using different versions of the angularjs library.

    0 讨论(0)
提交回复
热议问题