Closed rjferguson21 closed 9 years ago
Hi Rob,
I'm not really keen on having two setters for the namespace tbh, I feel that there isn't much need for setting a default namespace after the inital config has been called.
The reason I added the default namespace was to try and reduce the chance of any potential collisions with pre-existing keys.
I think a better way would be to have the ability to pass false during config which would remove the default namespace (and spacer), e.g. lockerProvider.setDefaultNamespace(false);
Thanks
I can understand that, ideally your namespace would be something static, and not dependent on the app already being in the run phase. In our application the prefix is specific to the user, which is only known after a user logs in which is what is inhibiting me from using lockerProvider.setDefaultNamespace
.
I do like your idea about passing false into setDefaultNamespace
.
What you might want to do instead is, grab an instance of locker that has your "default" namespace set, e.g.
app.controller('SomeCtrl', function (locker) {
var myLocker = locker.namespace('yourDefaultNamespace');
myLocker.put(); // etc
});
Would something like that work for you?
This might not fit everyone's use case but I think it would make sense to be able to put/get values that are not namespaced. It would also be helpful to be able to persistently set the namespace after the config phase.
There might have been an easier way to do this, but I just took a stab at it. Let me know if you see a way that would work better.