Working with a non-angular library requires establishing communication between them.
<div id="MoipWidget" data-token="{{personaltoken}}" callback-method-success="successCB" callback-method-error="errorCB"></div>
Upon page load, a token must be fetched from the server every time.
$http.post('https://example.org', obj)
.success(function(data){
$scope.personaltoken = data.token;
//However, calling the non-angular library results in an error stating that the token is undefined.
//It works as intended if executed within a $timeout...
})
.error(function(data){
alert('error');
});
Attempting to use $scope.$apply or $digest simultaneously leads to an error.
The non-angularjs library being invoked is quite simple, only involving two lines of code.
var settings = {}
LibraryCall(settings);
How can I promptly update the model?