Dirty read set flag for update record angular js

$scope.Update = function () {

var index = 0;
var arrPermissions = [];

$scope.dataResult.forEach(function (row) {
if (row.IsDirty == true) {
arrPermissions.push(row);
}
});

SpinStart();
$http.post(“Security/Update”, { ViewModels: arrPermissions })
.success(function (data) {

alert(” updated successfully.”);
})
.error(function () {
SpinStop();
alert(“Not valid.”);

});

}

// key press event
$scope.Changed = function (id) {
var result = $.grep($scope.dataResult, function (e) { return e.Id === id; });
result[0].IsDirty = true;
}
<tr ng-repeat=”permission in dataResult”>

<td >

<input type=”checkbox” checked=”checked” ng-model=”permission.Update” ng-click=”Changed(permission.Id)” />

</td>
</tr>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s