For some reason $scope.username
is not being passed to my controller. On click registerUser()
$scope.username
is undefined. I do have a scope and the function is running just no $scope.username.
For example:
HTML:
<input bs-form-control
type="text"
ng-model="username"
label="Username"
/>
<button class="btn btn-primary" ng-click="registerUser()">Register</button>
controller:
.controller("loginController", ['$scope',
function ($scope) {
$scope.registerUser = function(){
console.log($scope.username) // <=== undefined!
}
}])
My controller is passed using state:
.state('register', {
url: "/register",
templateUrl: "/static/html/profile/register.html",
controller: "loginController"
})