We have a checkbox to create news editing on php. You need to select all the fields from the database as they were filled in, select them for example in the checkbox, namely, put a tick in Azerbaijan, then I search for Australia, I remove the tick, then clear the search bar and in Azerbaijan there is no tick (namely, parameters from the script were adopted), how to select the check mark itself, but not to return anything to the original state. Here is an example:
var app = angular.module('app', []); app.controller('appCtrl', function($scope) { $scope.country = [ { 'name': 'Австрия', 'desc': 'Австрия', 'check': 'true' }, { 'name': 'Азербайджан', 'desc': 'Азербайджан', 'check': 'false' }, { 'name': 'Албания', 'desc': 'Албания', 'check': 'true' } ]; }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div class="container" ng-app="app" ng-controller="appCtrl"> <input ng-model="query"> <ul> <li ng-repeat="item in country | filter:query"> <label> <input name="country[]" type="checkbox" ng-model="item.selected" ng-checked="{{item.check}}" value="{{item.desc}}" >{{item.desc}}</label> </li> </ul> </div>