我试图从 Angular 控制器获取表单数据但没有成功。
HTML:
<form>
<input type="text" id="entityName" ng-model="ent.Name">
<button class="btn" type="button" onclick="this.blur()" ng-click="$event.preventDefault(); saveData()">Save</button>
</form>`
JS 控制器:
$scope.saveData = function() {
console.log($scope.ent.Name);
}
我收到错误:Error: $scope.ent is undefined