[angularJS]ng-hide|ng-show切换

<div class="row ng-scope">
    <div class="col-lg-12">
        <h1 class="page-header">详细信息</h1>
    </div>  
    <!-- /.col-lg-12 -->
</div>
<div class="panel panel-default">
<div class='panel-heading'>
    <div class="btn-group pull-right">
        <a ng-click="selectType=1" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-edit"></span></a>
        <a ng-click="selectType=0" class="btn btn-success btn-xs"><span class="glyphicon glyphicon-ok"></span></a>
    </div>个人资料
</div>
<div class="panel-body">
    <div class="row">
        <div class="col-lg-6 panel-body">
            <div class="form-group">
                <div style='position: relative;margin: 7px 13px;' class='todo-item' ng-hide="selectType" ng-class="{'todo-complete': item.complete}">
                    <p>{{user.model.username}}</p>
                </div>
                
                <div class='todo-item' ng-show="selectType">
                    <input type="text" class="form-control" ng-model="user.model.username" ng-class="{'todo-complete': item.complete}"/>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-6 panel-body">
            <div class="form-group">
                <div style='position: relative;margin: 7px 13px;' class='todo-item' ng-hide="selectType">
                    <p>{{user.model.email}}</p>
                </div>
                
                <div class='todo-item' ng-show="selectType">
                    <input type="email" class="form-control" ng-model="user.model.email" required/>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-6 panel-body">
            <div style='position: relative;margin: 7px 13px;' class='todo-item' ng-hide="selectType">
                <p>******</p>
            </div>
            
            <div class='todo-item' ng-show="selectType">
                <input type="password" ng-model="user.model.password" placeholder='Reset User password' required/>
            </div>
        </div>
    </div>
</div>

通过修改selectType切换ng-hide,ng-show改变内部文本

posted @ 2015-03-09 10:03  zaric  阅读(821)  评论(0编辑  收藏  举报