angularjs ng-submit is not working
eldyvoon opened this issue · 1 comments
I use angularjs and I think something is wrong with the controller, https://github.com/eldyvoon/megaboiletplate-angular-node/blob/master/app/controllers/login.js
line 16 will not be triggered when I try to trigger the ng-submit button.
I had the same problem
The problem is not ng-submit, but the fact that all controllers use this keyword inside instead of $scope and in the definition of the router all controllers don't use the controllerAs syntax that would allow the use of keyword this instead of $scope.
For resolve:
In the app/app.js uses controllerAs syntax for all controllers, like this:
.when('/login', { templateUrl: 'partials/login.html', controller: 'LoginCtrl', controlleAs: 'login', resolve: { skipIfAuthenticated: skipIfAuthenticated } })
and in the all views concatenate to all function/variable/ecc the keyword that you used in the controllerAs, like this:
<form ng-submit="login.login()"> <legend>Log In</legend> <div class="form-group"> <label for="email">Email</label>
This is the best solution, but you can replace keyword ctrl in all controllers with $scope and this also solves the problem.
This problema is a bug, i open new issue to report it.