相关疑难解决方法(0)

使用angular-ui的ui-date datepicker时,屏幕上的角度错误消息会非常短暂地闪烁

我遇到了一个问题,即尽管输入框中有输入,ng-message仍会闪烁"必需"的错误信息.会发生什么事情,它会非常简短地闪烁错误信息:"这个字段是必需的(所有这些都是为了让它更容易看到它闪烁!)"在屏幕上它立即消失之前.对不起,我想让消息在消失之前更容易看到.

这是我的plunker链接.请输入任何输入,然后单击页面上的其他位置,以便输入字段失去焦点. 请注意,因为红色的错误信息会短暂闪烁然后消失.如果您没有快速注意到消息闪烁,则必须重新加载页面才能再次看到它.

为什么会这样?我相信它与ui-date有关,因为我没有ui-date就无法复制问题.

这是代码的片段:

<form name="reportform" ng-submit="process_form()" novalidate >
  <input name="startdate" placeholder="Enter a start date" ui-date ng-model="startdatevalue"  required>
  <ng-messages ng-if='reportform.startdate.$touched' for="reportform.startdate.$error">
    <ng-message when="required" class="error-message">
      THIS FIELD IS REQUIRED (ALL IN CAPS TO MAKE IT EASIER TO SEE IT FLASH BY!)
    </ng-message>
  </ng-messages>
  <button ng-disabled="reportform.$invalid" type="submit">
    Submit Query
  </button>
</form>
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

angularjs angular-ui-datepicker

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

Angular中"Controller as"的优势是什么?

在Angular中使用"Controller as"语法有什么好处?是仅为控制器创建别名还是在幕后有其他技术原因?

我是Angular的新手,想要了解有关此语法的更多信息.

angularjs

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

$ scope.currentPage not updating - Angular Ui Pagination

我有这个codepen,并使用该函数'$scope.pageChanged'来查看页面何时更改.

$scope.pageChanged = function() {
 $log.log('Page changed to: ' + $scope.currentPage);
};
Run Code Online (Sandbox Code Playgroud)

但是当我点击页面链接(更改页面)时,变量'$scope.currentPage'不会改变.为什么?

我认为是有关的filter,但不确定.

javascript pagination angularjs angular-ui

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

保存输入文本框中ng-repeat中的所有值

我正在弄清楚如何通过ng-repeat单击按钮来保存输入文本框中输入的值.我已经看到这样的示例从文本框中获取值,用户可以单独保存每个文本框.以下是示例代码:

$scope.items=[1,2,3,4]

<div ng-repeat="item in items">
<input type="text" ng-model=item.id>
</div>
<button type="button" ng-click="saveAllValues()">Save</button>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs ng-repeat angularjs-ng-repeat

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

使用AngularJs无法获得textarea值

<tr class="labels">
    <td nowrap="nowrap">Address</td>
    <td nowrap="nowrap"><label for="tbAddress"></label>
        <textarea name="tbAddress" id="tbAddress" cols="39" rows="5" ng-model="$parent.tbAddress"></textarea>

    </td>

</tr>
<tr>
    <td>&nbsp;</td>
    <td align="right">
        <input type="submit" name="button" id="button" value="Submit Record" class="btns" />
        <input type="reset" name="button2" id="button2" value="Cancel" class="btns" />
    </td>
</tr>
Run Code Online (Sandbox Code Playgroud)

我无法textarea使用AngularJS 获得价值.所有input文本字段都通过控制器,除了textarea.我究竟做错了什么 ?

alert($scope.tbAddress);
var thisData = {
    'name': $scope.tbFN,
    'company': $scope.tbCompany,
    'designation': $scope.tbDesignation,
    'email': $scope.tbEmail,
    'phone': $scope.tbPhone,
    'mobile': $scope.tbMobile,
    'address': $scope.tbAddress
};
Run Code Online (Sandbox Code Playgroud)

这是警报未定义......

javascript angularjs angularjs-directive angularjs-scope

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