I'm trying to read the variable accessCode
in my form in a Angular (1.6.8) function but I only get undefined
.
The HTML
<form ng-submit="redeem()" ng-controller="SubscriptionCtrl as subscription">
<input class="text-uppercase" type="number" ng-maxlength="6" placeholder="Indtast kode" ng-model="accessCode" />
<input type="submit" class="btn btn-dark-green" value="Indløs" />
</form>
The Angular JS
app.controller('SubscriptionCtrl', ['$scope', '$http', '$templateCache',
function ($scope, $http, $templateCache) {
$scope.redeem = function () {
console.log($scope.accessCode);
};
}]);
Any ideas why I can't read $scope.accessCode?