相关疑难解决方法(0)

AngularJS检查表单在控制器中是否有效

我需要检查一个表单在控制器中是否有效.

视图:

<form novalidate=""
      name="createBusinessForm"
      ng-submit="setBusinessInformation()"
      class="css-form">
 <!-- fields -->
</form>
Run Code Online (Sandbox Code Playgroud)

在我的控制器中:

.controller(
    'BusinessCtrl',
    function ($scope, $http, $location, Business, BusinessService, 
              UserService, Photo)
    {

        if ($scope.createBusinessForm.$valid) {
            $scope.informationStatus = true;
        }

        ...
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:

TypeError: Cannot read property '$valid' of undefined
Run Code Online (Sandbox Code Playgroud)

angularjs

86
推荐指数
3
解决办法
11万
查看次数

标签 统计

angularjs ×1