Hallo an alle Leser dieses! Ich habe ein Problem beim Ausführen der Funktion in meiner Strg.Controller-Funktion funktioniert nicht in Angular.js
Ich habe versucht, einige Warnungen zu machen, console.log und suche hier nach der Antwort, aber fand nicht genau dasselbe Problem, nur ähnlich. ich jedem dankbar sein werde ich dieses Problem)
HTML
// ctrls.js
var gameApp = angular.module('gameApp');
var AuthorizationCtrl = gameApp.controller('AuthorizationCtrl', function($scope) {
$scope.email = email.value;
$scope.password = password.value;
$scope.signUp = function() { // this function isn't executed when I hope it to be
console.log($scope.email, $scope.password);
gameFactory.signUp(email, password).then(function() {
});
};
});
// services.js
function Factory(FBMSG, $firebaseArray, $firebaseAuth) {
var events = {},
ref = new Firebase(FBMSG),
games = $firebaseArray(ref),
auth = $firebaseAuth(ref);
events.getAllGames = function() {
return games.$loaded();
};
events.signUp = function(email, password) {
return auth.createUser({
email: email,
password: password
});
};
return events;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<!-- ng-view -->
<div ng-controller="AuthorizationCtrl" style="background-color: rgba(0, 0, 0, .5); width: 40%; margin:auto">
<form>
<div class="form-group">
<label for="email">Email address</label>
<input ng-model='email' type="email" class="form-control" id="email" placeholder="Email" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input ng-model="password" type="password" class="form-control" id="password" placeholder="Password" required>
</div>
<a href="">Forgot your password?</a>
<div>
<button ng-click="SignUp()">SignUp</button> <!-- Problem!!! -->
</div>
</form>
</div>
Woher bekommen Sie 'email.value'? "$ scope.email = email.value'" – theblindprophet
–
hier anmelden statt Anmeldung. Sie haben Ihre Kappen falsch, checken Sie die ng-klick –