考虑我有一个表单,ng-form
和控制器 -
var myAppModule = angular.module('myApp', []);
myAppModule.controller('myCtrl',function ($scope) {
});

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<div ng-app="myApp">
<div ng-controller="myCtrl" ng-form name="myForm">
Name : <input ng-model="name" type="text" />
</div>
</div>
&#13;
我如何才能在控制器中myCtrl
访问表单 - myForm
?
答案 0 :(得分:1)
$ scope.myForm将具有表单数据
var myAppModule = angular.module('myApp', []);
myAppModule.controller('myCtrl',function ($scope) {
var form = $scope.myForm;
});