I developed an application with a login page and a controller structured like this: ---->
--->over here :)
(function(){
'use strict';
angular
.module("loginApp",[])
.controller("loginCtrl",loginCtrl);
loginCtrl.$inject = ['$location','$scope','loginService'];
function loginCtrl($location,$scope,loginService){
var vm = $scope;
vm.login = login;
function login(){
var user = vm.user;
console.log(user);
};
}
})();
<body ng-app="loginApp" ng-controller="loginCtrl">
<div class="col-md-6 col-md-offset-3">
<h2>Login</h2>
<form name="form" ng-submit="login()" role="form" method="post">
<div class="form-group" ng-class="{ 'has-error': form.username.$dirty && form.username.$error.required }">
<label for="username">Username</label>
<input type="text" name="username" id="username" class="form-control" ng-model="user.username" required />
<span ng-show="form.username.$dirty && form.username.$error.required" class="help-block">Username is required</span>
</div>
<div class="form-group" ng-class="{ 'has-error': form.password.$dirty && form.password.$error.required }">
<label for="password">Password</label>
<input type="password" name="password" id="password" class="form-control" ng-model="user.password" required />
<span ng-show="form.password.$dirty && form.password.$error.required" class="help-block">Password is required</span>
</div>
<div class="form-actions">
<button type="submit" ng-disabled="form.$invalid || dataLoading" class="btn btn-primary">Login</button>
<img ng-if="dataLoading"/>
<a href="#/register" class="btn btn-link">Register</a>
</div>
</form>
</div>
...................
<!-- App -->
<script src="angular/scripts/login.router.js"></script>
<script src="angular/scripts/controllers/login/loginCtrl.js"></script>
However, after clicking the "login()" button, nothing happens. I am unsure of the reason why.