I can not understand why the conditional expression is not executed in this program:

<!DOCTYPE html> <html ng-app="purchaseApp"> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" /> </head> <body ng-controller="purchaseController"> <div class="page-header"> <h1> Список дел </h1> </div> <div class="panel"> <div class="form-inline"> <div class="form-group"> <div class="col-md-8"> <input class="form-control" ng-model="caseName" placeholder="Название" /> </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-8"> <button class="btn btn-default" ng-click="addItem(caseName)">Добавить</button> </div> </div> </div> <table class="table table-striped"> <thead> <tr> <th>Дела</th> </tr> </thead> <tbody> <tr ng-repeat="case in list.cases"> <span ng-if="case.isDone">Hey </span> <td>{{case.name}}</td> <td><button type="button"><span class="glyphicon glyphicon-ok"></span></button></td> <td><button type="button"><span class="glyphicon glyphicon-remove"></span></button></td> <td><button type="button"><span class="glyphicon glyphicon-trash"></span></button></td> </tr> </tbody> </table> </div> <script data-require="angular.js@1.6.0" data-semver="1.6.0" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.js"></script> <script> var model = { cases: [ { id: 1, name: "Сходить в магазин за хлебом", isDone: false }, { id: 2, name: "Вынести мусор", isDone: false }, { id: 3, name: "Победить дракона", isDone: true }, { id: 4, name: "Спасти принцессу", isDone: false } ] }; var purchaseApp = angular.module("purchaseApp", []); purchaseApp.controller("purchaseController", function ($scope) { $scope.list = model; $scope.addItem = function (caseName) { if(caseName != "") { $scope.list.cases.push({ id: 5, name: caseName, isDone: false }); } } }); </script> </body> </html> 

The string <span ng-if="case.isDone">Hey </span> does not work. Why and how to make it work? Link to plunker .

    1 answer 1

    You have the same table! So: <td><span ng-if="case.isDone">Hey</span></td>