且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

角引导模式面具形式

更新时间:2023-10-27 09:52:34

更新:角UI的引导0.12.0解决了这个问题 - transclusion范围变得与控制器的范围,没有必要 $父。。只要升级。

Update: angular ui-bootstrap 0.12.0 fixes the problem - transclusion scope becomes the same as controller's scope, no need for $parent.. Just upgrade.

之前0.12.0

角UI情态动词使用transclusion附加模式的内容,这意味着模态之内所做的任何新范围条目儿童范围内创建。这种情况与形式的指令。

Angular-UI modals are using transclusion to attach modal content, which means any new scope entries made within modal are created in child scope. This happens with form directive.

这是已知问题: https://github.com/angular-ui/bootstrap /问题/ 969

我提出的解决方法快速而对我的作品,具有角1.2.16:

I proposed the quick workaround which works for me, with Angular 1.2.16:

<form name="$parent.userForm">

窗体创建和模式的控制器可用 $范围。由于范围继承窗体访问在标记保持不变。

The userForm is created and available in modal's controller $scope. Thanks to scope inheritance userForm access stays untouched in the markup.

<div ng-class="{'has-error': userForm.email.$invalid}"}>