标签: angularjs-ui-utils

如何将angular ui-mask上的autoclear设置为false?

我目前有一个带有手机ui-mask的输入.如果输入的值不是掩码的全长,则清除输入.有没有办法设置ui-mask,以便在点击或失去焦点时不清除输入?

<input ui-mask="(999) 999-9999" type="text"/>
Run Code Online (Sandbox Code Playgroud)

angularjs angular-filters angularjs-ui-utils

7
推荐指数
2
解决办法
7107
查看次数

带有ng-pattern的Angularjs ui-mask

下面的代码不起作用..

<input type="text"
       class="form-control input-sm"
       placeholder="hh:mm:ss"
       name="hhmmss"
       ng-model="data.hhmmss"
       ui-mask="99:99:99"
       ng-pattern="/^([0-2]|0[0-9]|1[0-9]|2[0-3]):?[0-5][0-9]:?[0-5][0-9]$/"
/>
Run Code Online (Sandbox Code Playgroud)

当输入值是20:00:00,然后formName.hhmmss.$error.patterntrue.

如果删除ui-mask:

<input type="text"
       class="form-control input-sm"
       placeholder="hh:mm:ss"
       name="hhmmss"
       ng-model="data.hhmmss"
       ng-pattern="/^([0-2]|0[0-9]|1[0-9]|2[0-3]):?[0-5][0-9]:?[0-5][0-9]$/"
    />
Run Code Online (Sandbox Code Playgroud)

当输入值是20:00:00,然后formName.hhmmss.$error.patternfalse.

我如何使用正则表达式ng-pattern

regex angularjs ng-pattern angularjs-ui-utils

5
推荐指数
1
解决办法
6929
查看次数

如何验证ng重复的下拉类别选择器?

我创建了一个嵌套的类别模型.要为产品选择类别,您会看到包含主要类别的下拉列表.当您选择一个时,会在右侧添加一个新的下拉列表,其子类别将与您选择的类别相对应.这将重复,直到达到最后一级.发生这种情况时$scope.product.category_id设置.我想在整个的字段集无效$scope.product.category_idnull.

我一直在使用angular-bootstrap-show-errors进行验证,我尝试将它与ui-utils混合使用自定义函数来实现这个:validate_category().

这是我使用的HTML:

<span ng-repeat="parent_id in category_dropdown_parents" show-errors="{ skipFormGroupCheck: true }">
    <select class="form-control" name="category_id"
        ng-init="selected_category[$index] = init_select($index);"
        ng-model="selected_category[$index]"
        ng-options="category.name for category in (categories | filter : { parent_id: parent_id } : true ) track by category.id "
        ng-change="select_category(selected_category[$index], $index)"

        ui-validate="'validate_category()'" // added this to work with ui-utils

        >
    </select> 
    <span ng-if="$index+1 != category_dropdown_parents.length">/</span>
</span>
Run Code Online (Sandbox Code Playgroud)

这是我简单的验证功能:

$scope.validate_category = function() {
    return  (   $scope.product.category_id !== null 
            &&  $scope.product.category_id !== undefined); …
Run Code Online (Sandbox Code Playgroud)

validation angularjs angularjs-ui-utils

5
推荐指数
1
解决办法
526
查看次数

带角度输入掩码的输入掩码

我想制作输入掩码,以防CNPJ.

然后我在这里看到它.

https://github.com/assisrafael/angular-input-masks/

但没有实现.

请参阅我的代码中的摘录,在这种情况下它不起作用.

<html>
<head>
    <meta charset="utf-8">
    <script src="angular.js"></script>
    <script src="js/masks.min.js"></script>

    <script>
        angular.module('ui.utils.masks');
    </script>

</head>
<body ng-app>
    <ul>
        <li><a href="teste.html">Teste</a></li>
    </ul>

    <div>
        <label>CNPJ:</label>
        <input type="text" ng-model="cnpj" ui-br-cnpj-mask>
    </div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

工作缺少什么?

declaration mask angularjs angular-ui angularjs-ui-utils

4
推荐指数
1
解决办法
5081
查看次数

angularJS valdr + ui-select验证

我在谷歌搜索这个问题,但仍然无法找到正确的讨论.我们在一个表单(angularJS app)中使用valdr和ui select,我们遇到的问题是ui-select渲染的输入不会获得name属性,因此,angular会抛出一个错误:

Error: Form element with ID "undefined" is not bound to a field name.
at d.link (http://localhost:8080/bower_components/valdr/valdr.min.js:1:8414)
at invokeLinkFn (http://localhost:8080/bower_components/angular/angular.js:8141:9)
at nodeLinkFn (http://localhost:8080/bower_components/angular/angular.js:7653:11)
at compositeLinkFn (http://localhost:8080/bower_components/angular/angular.js:7009:13)
at nodeLinkFn (http://localhost:8080/bower_components/angular/angular.js:7648:24)
at http://localhost:8080/bower_components/angular/angular.js:7884:13
at processQueue (http://localhost:8080/bower_components/angular/angular.js:13071:27)
at http://localhost:8080/bower_components/angular/angular.js:13087:27
at Scope.$get.Scope.$eval (http://localhost:8080/bower_components/angular/angular.js:14287:28)
at Scope.$get.Scope.$digest (http://localhost:8080/bower_components/angular/angular.js:14103:31) <input type="text" autocomplete="off" tabindex="-1" aria-expanded="true" aria-label="{{ $select.baseTitle }}" aria-owns="ui-select-choices-{{ $select.generatedId }}" aria-activedescendant="ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}" class="form-control ui-select-search ng-pristine ng-untouched ng-valid" placeholder="{{$select.placeholder}}" ng-model="$select.search" ng-show="$select.searchEnabled &amp;&amp; $select.open">
Run Code Online (Sandbox Code Playgroud)

所以我们在ui-select指令上尝试了一些hack-select指令,例如templateCache重写/修改,隐藏的输入使用相同的模型,但结果是相同的.

btw templateCache重写是最糟糕的方法,因为这个指令在appwide中被其他指令使用,我们无法破解整个应用程序.

有人遇到过这个问题吗?

代码段: http ://plnkr.co/edit/sDNDDtnhi7Jxi9mtjDTl?p =preview

angularjs angularjs-directive valdr ui-select angularjs-ui-utils

4
推荐指数
1
解决办法
2339
查看次数

如何将Datepicker和Timepicker中的值组合在一个变量中

我有角度应用UI有Datepicker和Timepicker使用angular-ui当用户选择日期$Scope.dt和设置时间$Scope.mytime我试图合并在一个$ Scope.SelectedDateTime我得到NaN.我不知道如何解决它

当用户选择日期时更新$ scope.dt值将为'当用户选择日期时'确定'将于2015年3月5日00:00:00 GMT-0500(东部标准时间)'和$ scope.mytime值'2015年3月5日星期四23:30:00 GMT-0500(东部标准时间)'如何将它们组合在一个变量html中

      <h4>Popup</h4>
        <div class="row">
            <div class="col-md-6">
                <p class="input-group">
                  <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" />
                  <span class="input-group-btn">
                    <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                  </span>
                </p>
            </div>
        </div>
    <timepicker ng-model="mytime" ng-change="changed()" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></timepicker>
<button type="button" class="btn btn-sm btn-info" ng-click="SelectedDateTime()">Today</button>
Run Code Online (Sandbox Code Playgroud)

JavaScript的

    $scope.today = function() {
      $scope.dt = new Date();
    };
    $scope.today();
    $Scope.mytime = new Date();
 $scope.changed = function () {
    $log.log('Time changed to: ' + $scope.mytime);
  };

  $scope.clear = function() { …
Run Code Online (Sandbox Code Playgroud)

javascript datetime datepicker angularjs angularjs-ui-utils

1
推荐指数
1
解决办法
1812
查看次数