I was having a hard time doing some basic namespace/package-like stuff so I 
came up with the following that enables me to use angular modules as 
namespaces.  Am I missing something?

var setModuleValue = function (module, valName, value) {
    if (typeof module === "string") {
        module = angular.module(module);
    }
    if (module.localValues === undefined) {
        module.localValues = {};
    }
    module.localValues[valName] = value;
};

var getModuleValue = function (module, valName) {
    if (typeof module === "string") {
        module = angular.module(module);
    }
    if (module.localValues === undefined) {
        module.localValues = {};
    }
    return module.localValues[valName];
};


Thanks.


Blake McBride


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to