Hi telldurges,
While returning the DTDealerTehsil from Web API return with on more property as Selected based on the record you saved in database.
Then using the Selected Property you can CheckBox checked.
for more details refer below article.
Check this example.
View
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', [])
app.controller('MyController', function ($scope, $window) {
$scope.DTDealer = [
{ DealershipName: "Dealer 1", DealerCode: "1" },
{ DealershipName: "Dealer 2", DealerCode: "2" },
{ DealershipName: "Dealer 3", DealerCode: "3" },
];
$scope.OnDealerChange = function () {
$scope.DTDealerTehsil = [];
if ($scope.DealerCode == '1') {
$scope.DTDealerTehsil = [
{ TehsilName: "Tehsil 1", TehsilCode: "1", Selected: false },
{ TehsilName: "Tehsil 2", TehsilCode: "2", Selected: true },
{ TehsilName: "Tehsil 3", TehsilCode: "3", Selected: true },
{ TehsilName: "Tehsil 4", TehsilCode: "4", Selected: false }
];
} else if ($scope.DealerCode == '2') {
$scope.DTDealerTehsil = [
{ TehsilName: "Tehsil 1", TehsilCode: "1", Selected: true },
{ TehsilName: "Tehsil 2", TehsilCode: "2", Selected: true },
{ TehsilName: "Tehsil 3", TehsilCode: "3", Selected: false },
{ TehsilName: "Tehsil 4", TehsilCode: "4", Selected: true }
];
} else {
$scope.DTDealerTehsil = [
{ TehsilName: "Tehsil 1", TehsilCode: "1", Selected: false },
{ TehsilName: "Tehsil 2", TehsilCode: "2", Selected: false },
{ TehsilName: "Tehsil 3", TehsilCode: "3", Selected: false },
{ TehsilName: "Tehsil 4", TehsilCode: "4", Selected: true }
];
}
};
});
</script>
</head>
<body>
<div ng-app="MyApp" ng-controller="MyController">
Dealer<select id="ddldealer" ng-model="DealerCode" ng-change="OnDealerChange();"
ng-init="DealerCode=0">
<option value="0">--Select Dealer--</option>
<option ng-repeat="x in DTDealer" value="{{x.DealerCode}}">{{x.DealershipName}}</option>
</select>
<br />
Select Tehsil
<div ng-repeat="x in DTDealerTehsil">
<div ng-if="x.TehsilID != ''">
<input id="ddlselecttehsil" type="checkbox" ng-model="x.Selected" />
{{x.TehsilName}}
</div>
</div>
</div>
</body>
</html>
Screenshot