I have remarked a strange behavior in my code , I made a button where the action is to set a scope and show a bootstrap modal with the value of this scope
Normally the code should look like this
But that don't work i only get a empty value in the model
var table = $('#data').DataTable();
$('#data tbody').on('click', 'td.details-control,.addsta,.mjump,.mcon,.delwf', function () {
if (this.className == "btn btn-danger delwf") {
var tr = $(this).closest('tr');
var row = table.row(tr);
$scope.sworcode = row.data().worcode;
$scope.slancode = row.data().lancode;
console.log(row.data().worcode);
$('#modal-del').modal('show');
};
}
But if i add a HTTP request like this the value shows up in the modal
var table = $('#data').DataTable();
$('#data tbody').on('click', 'td.details-control,.addsta,.mjump,.mcon,.delwf', function () {
if (this.className == "btn btn-danger delwf") {
var tr = $(this).closest('tr');
var row = table.row(tr);
$http({
method: 'GET',
url: localhost + "/test"
}).then(function successCallback(response) {}, function errorCallback(response) {});
$scope.sworcode = row.data().worcode;
$scope.slancode = row.data().lancode;
console.log(row.data().worcode);
$('#modal-del').modal('show');
};
}
Can anyone explain this please ?