I have a very basic bootstrap modal and when the user clicks ok it assigns $scope.accountID
to a value.
It works perfectly ( it prints on the console the value I wanted)
But the ng-model does not update until I trigger the modal again and {{accountID}}
only updates after I open the modal again.
What is this???
Controller
// when user selects a row from the table
$scope.selectCustomer = function (customer) {
BootstrapDialog.confirm({
title: 'Confirm customer selection',
message: 'Are you sure that you want to select the customer <b>' + customer.FIRST_NAME + " " + customer.LAST_NAME + "</b> with Account ID " + customer.ACCOUNT_ID + "?",
type: BootstrapDialog.TYPE_INFO, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
closable: true, // <-- Default value is false
draggable: true, // <-- Default value is false
btnCancelLabel: 'Cancel', // <-- Default value is 'Cancel',
btnOKLabel: 'Ok', // <-- Default value is 'OK',
btnOKClass: 'btn-primary', // <-- If you didn't specify it, dialog type will be used,
callback: function(result) {
// result will be true if button was click, while it will be false if users close the dialog directly.
if(result) {
$scope.accountID = customer.ACCOUNT_ID;
console.log(customer.ACCOUNT_ID); // this prints correctly
}
}
});
};
HTML
<pre>{{accountID}}</pre> // this only updates when I open the modal, click ok and then open modal again