The problem is that i can't to access to set
method :
this.$get = function( $http ) {
return
{
set: function(UserData)
{
this.user = UserData ;
localStorage.setItem('user', JSON.stringify( UserData ) );
},
get: function()
{
return this.user;
},
send: function(data)
{
$http.post(BASE_URL + 'user/login', data)
.then( function( res ){
// Error !
this.set(res.data);
console.log(this); // return window object
// Here i want to access to 'this.set()'
// but i get error: 'ypeError: this.set is not a function'
});
}
}
}
I search for solution to access to this.set()
Thanks !