[英]Accessing a form in an Angular-UI uib-tab
If you have a form in a uib-tab
, how do you access it to (eg) validate the form? 如果您在uib-tab
有表格,则如何访问它以(例如)验证表格?
Here's a plunker: http://plnkr.co/edit/8hTccl5HAMJwUcHEtnLq?p=preview 这是一个小矮人: http ://plnkr.co/edit/8hTccl5HAMJwUcHEtnLq?p=preview
When I try access $scope.forminside
it's undefined (the form inside the uib-tab). 当我尝试访问$scope.forminside
它是未定义的(uib-tab中的表单)。 But if I do the same with $scope.formoutside
I get access to form validation etc. 但是,如果我对$scope.formoutside
执行相同操作, $scope.formoutside
可以访问表单验证等。
The uib-tabset
has its own scope, so the forminside
will be on the scope of the uib-tabset
. uib-tabset
有其自己的范围,因此, forminside
将在uib-tabset
的范围内。 If you use the controller-as notation, it will find the correct scope (the one of the controller): 如果使用controller-as表示法,它将找到正确的范围(控制器之一):
<uib-tab index="0" heading="Tab 1">
<form name="vm.forminside">
</form>
</uib-tab>
See this edited plunker . 看到这个编辑的punker 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.