Angularjs - Tab键无法从一个输入更改为另一个输入

时间:2016-12-02 12:42:54

标签: javascript angularjs angular-ui-router

使用

重定向页面时,输入之间的标签不起作用
$state.go('page.login');

ng-href

如果我在某些页面中重新加载带有F5的页面,它可以正常工作,而在其他页面中则无法正常工作。

路线以这种方式建造:

.state('page.login', {
          url: '/login',
          requireLogin: false,
          templateUrl: Route.components('user/login/login.html'),
          resolve: {
            assets: Route.require('oitozero.ngSweetAlert')
          }
        })

例如,登录页面是:

<div class="container ctainer-sm animated fadeInDown" ng-controller="LoginController">
   <div class="center-block mt-xl">
      <!-- START panel-->
      <img src="{{RESOURCES.IMAGE}}web/logo_clovinn-50px.png" alt="Clovinn Logo" class="center-block img-rounded margin-height-20" />
      <div class="panel col-md-offset-2 col-md-8">
         <div class="panel-body">
            <p class="pv text-bold">
               <span translate="MODULES.LOGIN.LOGIN"></span>
            </p>
            <form role="form" name="loginForm" class="mb-lg" ng-submit="login(loginForm.$valid)" novalidate>
               <div class="row" ng-show="loginForm.error">
                  <div class="col-md-12">
                     <div class="alert ng-isolate-scope alert-danger alert-dismissable" ng-class="['alert-' + (type || 'warning'), closeable ? 'alert-dismissable' : null]" role="alert" type="danger">
                        <div>
                           <span class="ng-binding ng-scope" translate="ERROR.{{loginForm.errorMessage}}"></span>
                        </div>
                     </div>
                  </div>
               </div>
               <div class="row">
                  <div class="col-md-12">
                     <div class="form-group has-feedback mb">
                        <input id="username" type="text" ng-model="loginForm.username" placeholder="{{username_placeholder}}" autocomplete="off" required class="form-control" ng-class="{ 'has-error' : loginForm.username.$invalid && !loginForm.username.$pristine }" ng-minlength="3" />
                        <span class="fa fa-user form-control-feedback text-muted"></span>
                     </div>
                     <br/>
                     <div class="form-group has-feedback">
                        <input id="password" ng-model="loginForm.password" type="password" placeholder="{{password_placeholder}}" required class="form-control" ng-class="{ 'has-error' : loginForm.password.$invalid && !loginForm.password.$pristine }" ng-minlength="3" />
                        <span class="fa fa-lock form-control-feedback text-muted"></span>
                     </div>
                     <div class="checkbox c-checkbox pull-left mt0">
                        <label>
                           <input type="checkbox" value="" />
                           <span class="fa fa-check"></span>
                           <label class="nopadding" translate="MODULES.LOGIN.REMEMBERME"></label>
                        </label>
                     </div>
                     <div class="row">
                        <div class="col-md-12">
                           <button type="submit" ng-disabled="loginForm.$invalid" class="btn btn-block btn-info mb">
                              <span translate="MODULES.LOGIN.LOGINBUTTON"></span>
                           </button>
                        </div>
                     </div>
                  </div>
               </div>
            </form>
         </div>
      </div>
   </div>
</div>

另一个更复杂的形式是:

<div ng-controller="CustomerCreateController">
    <a ng-click="back()" class="mr btn btn-labeled btn-default">
        <span class="btn-label"><i class="fa fa-arrow-left"></i>
        </span><span translate="PAGE.BACK" class="nopadding"></span>
      </a>
   <div class="app-view-header">
   <span translate="PAGE.CREATE" class="nopadding"></span><small><span translate="MODULES.CUSTOMER.A-CUSTOMER" class="nopadding"></span></small>

</div>
<div class="row">
    <div class="col-md-offset-2 col-md-8">
      <div class="panel panel-default">
        <div class="panel-heading"><h1><span translate="MODULES.CUSTOMER.CREATE" class="nopadding"></span></h1></div>
          <div class="panel-body">
            <div class="row">
              <div class="col-md-12">
                <form role="form" name="data" class="mb-lg form-validate" ng-submit="Create(data.$valid)" novalidate>
                <div class="row" ng-show="values.error">
                  <div class="col-md-12">
                    <div class="alert ng-isolate-scope alert-danger alert-dismissable" ng-class="['alert-' + (type || 'warning'), closeable ? 'alert-dismissable' : null]" role="alert" type="danger">
                    <div>
                      <span class="ng-binding ng-scope"><span translate="ERROR.{{values.code}}" class="nopadding"></span></span>
                    </div>
                  </div>
                  </div>
               </div>
               <div class="row mb-lg">
                  <div class="col-md-6">
                    <div class="form-group">
                        <label for="real_name" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.REAL-NAME"></label>
                        <div class="col-sm-8">
                            <input id="real_name" ng-model="values.object.real_name" type="text" required ng-class="{ 'has-error' : values.object.real_name.$invalid && !values.object.real_name.$pristine, 'duplicated': duplicated('real_name') }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="fantasy_name" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.FANTASY-NAME"></label>
                        <div class="col-sm-8">
                            <input id="fantasy_name" ng-model="values.object.fantasy_name" type="text" ng-class="{ 'has-error' : values.object.fantasy_name.$invalid && !values.object.fantasy_name.$pristine, 'duplicated': duplicated('fantasy_name') }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-lg">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="cuit" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.CUIT"></label>
                        <div class="col-sm-8">
                            <input id="cuit" ng-model="values.object.cuit" ui-mask="99-99999999-9" type="text" ng-class="{ 'has-error' : values.object.cuit.$invalid && !values.object.cuit.$pristine, 'duplicated': duplicated('cuit') }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="fax" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.FAX"></label>
                        <div class="col-sm-8">
                            <input id="fax" ng-model="values.object.fax" type="text" ng-class="{ 'has-error' : values.object.fax.$invalid && !values.object.fax.$pristine }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-lg">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="state" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.STATE"></label>
                        <div class="col-sm-8">
                            <ui-select id="state" ng-model="values.state" required ng-change="getCities(values.state.id)" class="text-left">
                               <ui-select-match class="ui-select-match" placeholder="{{values.placeholders.state}}">{{values.state.name}}</ui-select-match>
                               <ui-select-choices class="ui-select-choices" repeat="item in values.states | filter: $select.search">
                                  <span ng-bind-html="item.name | highlight: $select.search"></span>
                               </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="city" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.CITY"></label>
                        <div class="col-sm-8">
                            <ui-select ng-disabled="!values.stateSelected" id="city" ng-model="values.object.city" ng-change="values.citySelected = true" required class="text-left">
                               <ui-select-match class="ui-select-match" placeholder="{{values.placeholders.city}}">{{values.object.city.name}}</ui-select-match>
                               <ui-select-choices class="ui-select-choices" repeat="item in values.cities | filter: $select.search">
                                  <span ng-bind-html="item.name | highlight: $select.search"></span>
                               </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-lg">
                <div class="col-md-12">
                    <div class="form-group">
                        <label for="address" class="col-sm-2 control-label" translate="MODULES.CUSTOMER.ADDRESS"></label>
                        <div class="col-sm-10 pl-10">
                            <ui-select id="address" ng-model="values.address" theme="bootstrap" ng-disabled="!values.citySelected" nreset-search-input="false">
                               <ui-select-match class="ui-select-match" placeholder="{{values.placeholders.address}}">{{$select.selected.formatted_address}}</ui-select-match>
                               <ui-select-choices class="ui-select-choices" repeat="address in addresses track by $index" refresh="refreshAddresses($select.search)" refresh-delay="0">
                                  <div ng-bind-html="address.formatted_address | highlight: $select.search"></div></ui-select-choices>
                               </ui-select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row mb-lg">
                <div class="col-md-12">
                    <div class="form-group">
                        <label for="email" class="col-sm-2 control-label" translate="MODULES.CUSTOMER.EMAIL"></label>
                        <div class="col-sm-10 pl-10">
                            <input id="email" ng-model="values.object.email" type="email" ng-class="{ 'has-error' : values.object.email.$invalid && !values.object.email.$pristine, 'duplicated': duplicated('email') }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row  mb-lg">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="phone" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.PHONE"></label>
                        <div class="col-sm-8">
                            <input id="phone" ng-model="values.object.phone" type="text" ng-class="{ 'has-error' : values.object.phone.$invalid && !values.object.phone.$pristine }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="mobile_phone" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.MOBILE-PHONE"></label>
                        <div class="col-sm-8">
                            <input id="mobile_phone" ng-model="values.object.mobile_phone" type="text" ng-class="{ 'has-error' : values.object.mobile_phone.$invalid && !values.object.mobile_phone.$pristine }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <hr />
            <div class="row">
                <div class="col-md-12">
                    <h3><span translate="MODULES.CUSTOMER.CONTACT"></span></h3>
                </div>
            </div>
            <br />
               <div class="row">
                  <div class="col-md-6">
                    <div class="form-group">
                        <label for="name" class="col-sm-4 control-label" translate="COMMON.NAME"></label>
                        <div class="col-sm-8">
                            <input id="name" ng-model="values.object.name" type="text" required ng-class="{ 'has-error' : values.object.name.$invalid && !values.object.name.$pristine }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="last_name" class="col-sm-4 control-label" translate="MODULES.CUSTOMER.LAST-NAME"></label>
                        <div class="col-sm-8">
                            <input id="last_name" ng-model="values.object.last_name" type="text" required ng-class="{ 'has-error' : values.object.last_name.$invalid && !values.object.last_name.$pristine }" ng-minlength="2" class="form-control">
                        </div>
                    </div>
                </div>
            </div>
            <hr />
            <div class="row">
                <div class="col-md-12">
                    <h3><span translate="MODULES.CUSTOMER.LOGO"></span></h3>
                </div>
            </div>
            <br />
            <div class="row">
                <div ng-show="!values.filesubmitted" class="col-md-8 no-padding-right">
                    <div class="dropzone" id="dropbox" callback-fn="upload(video)" file-dropzone="[image/bmp, image/x-windows-bmp, image/gif, image/jpeg, image/png]"
                    file="image" file-name="imageFileName" values-max-file-size="3000">
                        <span ng-show="values.object.filename == undefined" translate="COMMON.DROPIMAGE"></span>
                        <span ng-show="values.object.filename != undefined">{{values.object.filename}}</span>
                    </div>
                </div>
                <div ng-show="!values.filesubmitted" class="col-md-4 upload-btn no-padding-left">
                    <label class="upload-search btn btn-primary  no-padding">
                    <div>
                        <input type="file" onchange="angular.element(this).scope().upload(this.files[0])"/>
                        <i class="fa fa-upload"></i>
                        <span translate="COMMON.FILESEARCH"></span>
                    </div>
                    </label>
                </div>
                <div ng-show="values.uploading" class="col-md-12">
                    <div>
                        <progressbar value="values.progress" class="progress-striped active">{{values.progress}}%</progressbar>
                    </div>
                </div>
                <div ng-show="values.object.logo" class="col-md-12">
                    <img class="img-responsive center" src="{{RESOURCES.CUSTOMER}}{{values.object.code}}/{{values.object.logo}}">
                </div>
            </div>
            <hr />
            <div class="row">
              <div class="col-md-12 text-right">
              <button type="reset" class="btn btn-labeled btn-danger"  ng-click="reset()">
                    <span class="btn-label"><i class="fa fa-times"></i>
                    </span><span translate="PAGE.RESET" class="nopadding"></span>
                </button>
                <button ng-disabled="data.$invalid" type="submit" class="btn btn-labeled btn-success">
                    <span class="btn-label"><i class="fa fa-check"></i>
                    </span><span translate="PAGE.CREATE" class="nopadding"></span>
                </button>
                </div>
            </div>
            </form>
        </div>
      </div>
    </div>
  </div>
</div>
</div>

如果您需要任何其他信息,请与我们联系。

0 个答案:

没有答案