Skip to content Skip to sidebar Skip to footer

Angularjs : Window.angular Variable

I was looking for informations to window.angular variable and i found nothing expect this post. In this post we have the following code : (function(angular, undefined){ 'use s

Solution 1:

It has nothing to do with ensuring angular is here. It's the syntax that, as I know, does 3 things:

  1. Allows the minifier to change the names of locally scoped variables
  2. Decrease the access time to a variable, since it's locally scoped
  3. If someone would've created a locally scoped "angular" variable, you will be sure you're using the global one by explicitly using the window variable

But since the IIFE is invoked immediately, according to it's definition, it doesn't ensure in any way that window.angular is presented.

Post a Comment for "Angularjs : Window.angular Variable"