<div ng-repeat="item in places">
<input type="radio" name="rdnPriority" value="{{item}}" ng-checked="exists(item,selected)" ng-click="toggle(item,selected)" >{{item}}<label>
var app = angular.module("myModule", ['ngMaterial', 'ngMessages']);
app.controller("GetTicketDetails", function ($scope, $http, $interval) {
$scope.GetOrders = function () {
var url = window.location.search;
url = url.replace("?", ''); // remove the ?
//alert(url);
debugger;
$http({
url: "../api/GetOrderDetailByDate",
method: "GET"
}).then(function (response) {
console.log(response.data);
$scope.ListTicketDetails = response.data;
$scope.TotalTickets = response.data.length;
$scope.selected = [];
$scope.places = [];
// when user clicks on checkbox, change selected list
$scope.toggle = function (item, list) {
var idx = list.indexOf(item);
if (idx > -1) list.splice(idx, 1);
else list.push(item);
};
// is item exists in list
$scope.exists = function (item, list) {
debugger;
debugger;
if (scope.checked == item) {
scope.checked = false;
}
return list.indexOf(item) > -1;
};
// process user data and prepare whole places
angular.forEach($scope.ListTicketDetails, function (x, key) {
if ($scope.places.indexOf(x.OrderStatus) == -1) {
//$scope.recordLimit = 5;
$scope.places.push(x.OrderStatus);
}
});
}
app.filter('SelectedTags', function () {
// filter to check array of elements
return function (users, tags) {
return users.filter(function (x) {
if (tags.indexOf(x.OrderStatus) != -1) {
return true;
} else if (tags.length == 0) {
return true;
}
return false;
});
};
})
Hello , I have written a AngularJS Custom filter that filters the orders based on status using RadioButton Check . The problem is data is filtering but Radio Button I need to double click one click for Uncheck existing checked and next check othr status . Is there a way i can achieve that with just single check on there options of radio button .
{{Item}} is filtering all orderstatus from array and rendering radio button Inputs options.
Please help