当使用角度单击某些行时如何显示div

时间:2019-03-19 10:26:39

标签: jquery html angularjs

我有这张桌子: Click here to view photo for example

我希望在单击表中的某些行时显示div(或显示我想要的div的活动“编辑”按钮)。 我正在使用角度。 我怎样才能做到这一点? 有人能帮我吗? 我是编程新手,如果我的问题不太清楚,我感到抱歉。 我有一个代码:

<button id="editbtn">Edit</button>
<button id="addbtn">Add</button>

<div class="hideShow" style="display: none;">
<div class="form">
<form ng-submit="saveItem(userForm.$valid)" name="userForm">
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label for="database_address">Потребителско име</label>
                <input type="text" class="form-control" required ng-model="activeItem.username" placeholder="Потребителско Име..." />
            </div>

            <div class="form-group">
                <label for="password">Парола*</label>
                <input type="text" class="form-control" id="password" ng-model="activeItem.passwordString"  />
            </div>
            <div class="form-group">
                <label for="password">Потвърждаване на парола*</label>
                <input type="text" class="form-control" id="password" ng-model="activeItem.passwordConfirm"  />
            </div>
              <p ng-show="(activeItem.passwordString != activeItem.passwordConfirm)" style="color:red">Паролите не съвпадата</p>

        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label for="username">Оператор</label>
                <input type="text" class="form-control" required id="username" ng-model="activeItem.name" />
            </div>
        </div>
    </div>
    <button class="btn btn-primary" ng-disabled="userForm.$invalid" type="submit">Запиши</button>
    <!--<button class="btn btn-primary" ng-disabled="userForm.$invalid" type="submit">Добавяне на нов</button>-->
</form>
</div>
</div>
<div class="hideShow1" style="display: none;">
<div class="form">
<form ng-submit="createUser(userForm1.$valid)" name="userForm1">
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label for="database_address">Потребител</label>
                <input type="text" class="form-control" ng-model="usernamee" placeholder="Потребителско Име..." />
            </div>

            <div class="form-group">
                <label for="password">Парола</label>
                <input type="text" class="form-control" ng-model="passwordd" required id="password"   />
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label for="username">Оператор</label>
                <input type="text" class="form-control" ng-model="namee" required id="username"  />
            </div>
        </div>
    </div>
    <button class="btn btn-primary"  type="submit">Запиши</button> <!--ng-click="createUser()"-->
    <!--<button class="btn btn-primary" ng-disabled="userForm.$invalid" type="submit">Добавяне на нов</button>-->
</form>
</div>
</div>
<!----------------------------FORM FOR ADD USER---------------------------->

</body>
<script>
$('button').click(function(){    
  if(this.id == 'editbtn'){
    $('.hideShow').show();
    $('.hideShow1').hide();
  }else{
    $('.hideShow').hide();
    $('.hideShow1').show();
  }
})

</script>

0 个答案:

没有答案