Ich bin neu in AngularJS. Weiß jemand, warum ich diese Störung erhalte - Argument 'activationCtrl' is not a function, got undefined
AngularJS - Controller kann nicht definiert werden
HTML -
<div class="form-group row">
<label for="member" class="col-sm-2 form-control-label">Member</label>
<div class="col-sm-10">
<input type="number" class="form-control" id="memberId" placeholder="Member" ng-click = "activation.zipcode()">
</div>
</div>
-Controller -
angular.module('app', [])
.controller('activationCtrl', activationCtrl);
function activationCtrl() {
var self = this;
self.zipCode = function() {
console.log("zipcode");
}
}
Staat -
.when('/activation', {
templateUrl: 'views/activation.html',
controller: 'activationCtrl',
controllerAs: 'activation'
})
in gegebenem Fall ist es nicht notwendig eine ng-Controller-Richtlinie überall, wie in der obigen Code-Controller in Template-Definition wird hinzuzufügen. – k10der