Ответы пользователя по тегу Angular
  • Angular. Как реализовать ng-show, ng-hide в определенной итерации?

    <table class="table table-striped col-md-6">
        <tr>
            <th class="col-md-5">Полный адрес</th>
            <th class="col-md-3">Координаты</th>
            <th class="col-md-4">Комментарий</th>
            <th></th>
        </tr>
        <tr
        ng-init="data.edit = false"
        ng-repeat="data in addressList"
        ng-click="data.edit = !data.edit"
        ng-hide="data.edit">
            <td>{{data.address}}</td>
            <td>{{data.latitude}} / {{data.longitude}}</td>
            <td>{{data.description}}</td>
            <td class="col-sm-2">
                <button class="btn btn-danger" ng-click="removeAddress(data)">
                    <span class="glyphicon glyphicon-trash"></span>
                </button>
            </td>
        </tr>
        <tr ng-repeat="item in addressList" ng-show="item.edit">
            <td><input type="text" ng-model="item.address"></td>
            <td><input type="text" ng-model="item.latitude"><input type="text" ng-model="item.longitude"></td>
            <td><input type="text" ng-model="item.description"></td>
            <td><button class="btn btn-success" ng-click="close()">Сохранить</button><button class="btn btn-danger" ng-click="close()">Отмена</button></td>
        </tr>
    </table>
    Ответ написан
    2 комментария