i have a html table which is binding using angularjs using ng-repeat.
How to add conditions in ng-repeat in angular js?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Rajeev PunhaniRank #551 · 4.4K reputationPosted Jul 4, 2016, 2:22 AM EDT
Hi Sant Roy,
Youcan use ng-if inside ng-repeat
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jul 8, 2016, 10:36 PM EDT
MayankRank #4,018 · 371 reputationPosted Nov 15, 2016, 2:24 AM EST
mainApp.controller('FilterStudentsController', function ($scope, $filter) {
var cars = [
{ Name: "Alto", Createdby: "Maruti",IsActive:"true" },
{ Name: "Figo", Createdby: "Ford",IsActive:"true" },
{ Name: "Innova", Createdby: "Hyundai", IsActive: "true" },
{ Name: "TATA", Createdby: "Nano", IsActive: "true" },
{ Name: "Maruti 800", Createdby: "Maruti", IsActive: "false" },
];
$scope.cars = cars;
$scope.update = function () {
$scope.cars = $filter('filter')(cars, { Createdby: $scope.selectedCar });
}
});
Html:
Cars:
You selected: {{selectedCar}}
Name
Createdby
{{car.Name}}
{{ car.Createdby}}
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts