The two way bindings get updated during an angular digest cycle. These cycles get triggered by DOM events bound to directives, or other entities participating in the Angular ecosystem.
So the "magic" that Angular provides, is just automatic triggering of that digest cycle. You can trigger the digest cycle with $scope.apply
:
promise.then(function(response) {
$scope.$apply(function() {
console.log('success');
$scope.setUser('test');
});
});
This is the recommended approach when dealing with 3rd party libraries.