I'm trying to make a log-in section on a website. Before the user is logged in, I want an area to say "Login". After the user is logged in, I want the area to display the username. The user logs in by pressing a button.
The HTML has something like this:
<a href="login.html ng-bind="userID">Login</a>
<body ng-app="loginButton" ng-controller="loginControl">
<form ng-submit="enterSite()">
<p>User ID <input type="text" ng-model="userID"></p>
<input type="submit" Value="Log In">
</form>
</body>
and then the JS has something like this:
var appButton = angular.module("loginButton", []);
appButton.controller("loginControl", ["$scope", "$window", function($scope, $window){
$scope.enterSite = function(){
if (/*they are a valid user*/){
$scope.apply();
}
}]);
Aucun commentaire:
Enregistrer un commentaire