Skip to content

Global variable issue #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sandyplace opened this issue Apr 6, 2013 · 3 comments
Closed

Global variable issue #75

sandyplace opened this issue Apr 6, 2013 · 3 comments

Comments

@sandyplace
Copy link

Several variables are defined at the top of angular-ui-states.js. These variables are essentially global as the file is not wrapped in a closure.

var isDefined = angular.isDefined,
    isFunction = angular.isFunction,
    isString = angular.isString,
    isObject = angular.isObject,
    isArray = angular.isArray,
    forEach = angular.forEach,
    extend = angular.extend,
    copy = angular.copy;

I am using another package called showdown.js which also has var forEach.. defined. It is overwriting the one declared in the angular-ui-states.js library which is throwing an exception. I fixed this by enclosing the entire angular-ui-states.js library in a closure:

(function(){
    'use strict';

var isDefined = angular.isDefined,
    isFunction = angular.isFunction,
    isString = angular.isString,
    isObject = angular.isObject,
    isArray = angular.isArray,
    forEach = angular.forEach,
    extend = angular.extend,
    copy = angular.copy;
...
)();
@ksperling
Copy link
Contributor

Hm, the anonymous function used to be there... looks like with the change to grunt 0.4 those snippets from the grunt file aren't being included anymore...

@jeme
Copy link
Contributor

jeme commented Apr 6, 2013

I can add that back in the same way i do in my own solution, by adding pre- and suf-fix files or will you look at it @ksperling ?

@ksperling
Copy link
Contributor

just committing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants