I'm re-working the registration form for Kids In Touch today. Every time I tried to submit the form, I got an error :
TypeError: object is not a function
at http://localhost:8000/js/angular/angular.min.js:162:37
at http://localhost:8000/js/angular/angular-touch.min.js:11:313
at h.$eval (http://localhost:8000/js/angular/angular.min.js:101:145)
at h.$apply (http://localhost:8000/js/angular/angular.min.js:101:423)
at HTMLButtonElement.<anonymous> (http://localhost:8000/js/angular/angular-touch.min.js:11:295)
at http://localhost:8000/js/angular/angular.min.js:27:147
at q (http://localhost:8000/js/angular/angular.min.js:7:380)
at HTMLButtonElement.Xc.c (http://localhost:8000/js/angular/angular.min.js:27:129) angular.js:9383
I was stumped for a while. As usual, the stacktrace in JavaScript is pretty useless when libraries like AngularJS are used.
It finally dawned on me that my form name and the ng-click action on the submit button were the same. Example:
<form name="register">
...
...
<button class="button button-full button-balanced" ng-click="register()" ng-show="register.$valid">
Create Account
</button>
</form>
It seems the ng-click="register()"
is confused by the form name.
Lesson learned : <form name="registrationForm">