0
我无法使用$ scope.myform获取表单有效性$ valid &我收到一条未定义的消息“无法读取属性'$ valid'of undefined”。无法获得表单有效性
<body ng-controller="MainCtrl">
<form name="myform">
Name: <input type="text" ng-model="user.name" /><br>
Email: <input type="email" ng-model="user.email" /><br>
</form>
</body>
app.controller('MainCtrl', function($scope) {
console.log($scope.myform.$valid);
});
Plnkr:http://plnkr.co/edit/P2kg1l64d4t7k7X4d4jh?p=preview