angularjs从指令访问另一种形式

时间:2014-08-19 12:03:36

标签: angularjs angularjs-directive

<ng-form name="innerForm">                                      
    <select ng-model="obj1" ng-options="i as i for i in selectTrueFalse" my-drective">...</select>
</ng-form>

<ng-form name="innerForm">                                      
    <select ng-model="obj2" ng-options="i as i for i in selectTrueFalse" my-drective">...</select>
</ng-form>

上面的两个选择元素围绕单独的表单元素。在angularjs指令中,我们可以访问下面提到的当前表单,但据我所知,它只能访问当前表单。我需要访问其他表单才能访问其他表单中的元素,例如如果正在为obj1评估指令,那么当时如何访问obj2。有办法吗?

app.directive('myDirective'), function() {
    return {
        require: '^form'

0 个答案:

没有答案