Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

checkFormValidity(form) is failing with controller as naming. #47

@rluiten

Description

@rluiten

Firstly so far loving the library.
What I have setup here.

My controller is aliased "MyController as vm" in web page context.

<form name="vm.myform" ng-submit="vm.submit()">
     <etc>
</form>

In my controller, I have an alias to be vm = this; where this is the controller.

app.controller('MyController', ['validationService', function (validationService) {
  var vm = this;
  vm.submit = function () {
   // this does work
   new validationService().checkFormValidity($scope); 

   // this does work not work I believe it should
   new validationService().checkFormValidity(vm.myform);
  }
}]);

The error I get for the "vm.myform" naming is as follows.

"checkFormValidity() requires a valid Angular Form or $scope object passed as argument to work properly (ex.: $scope.form1  OR  $scope)."

I have used the controller as naming sytnax to access forms in a few other scenarios and never encountered a problem before now.

Not sure this is something you can do anything about but thought i would mention it.
I find the controller as syntax far superior to $scope.

I am currently using angular v1.3.13 and angular-validation 1.3.35.

Cheers,
Rob

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions