After setting a value to a var it still contains its default value
<p>In my Model I default certain variables to <code>null</code></p>

<pre><code>angular.module('qbs.models').service('loginModel', function () {

this.name = 'loginModel';

var data = {
    //.......
    loggedIn: null,
    loggedOut: null
    //.......
};

this.set = function (key, value) {
    data[key] = value;
};

this.get = function (key) {
    return data[key];
};

this.getAll = function () {
    return data;
};
});
</code></pre>

<p>Later on after succesfully loggin in I set <code>loggedIn</code> to <code>true</code></p>

<pre><code>loginModel.set('loggedIn', true);
</code></pre>

<p>When I read out the Model with <code>console.log</code> the property is set correctly. However, when retrieving the value with </p>

<pre><code>`loginModel.get('loggedIn');`
</code></pre>

<p>I still get <code>null</code></p>

<p>The question is how this can be. Seems like I am refering to a property on another Object?!</p>