main.html中
<div ng-controller="myCtrl">
....
<direcitve here>
</div>
directive.html
<form name="myForm">
<input name="inputOne" ng-model="formData.one" required>
<input name="inputTwo" ng-model="formData.two" required>
<input name="inputThree" ng-model="formData.three" required>
</form>
我试图通过控制器访问指令中的表单,如下所示:
controller.js
$scope.myform
但我一直在undefined
。有什么建议吗?