-2
我的代碼到目前爲止是這樣的,它鏈接到main.js
。HTML無法登錄
<!DOCTYPE html>
<html ng-app="grocceryStore">
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.2/angular.js"></script>
<script src="js/angular-ui.js"></script>
<script src="js/app.js"></script>
<script src="js/items.js"></script>
<script src="js/product.js"></script>
<script src="js/main.js"></script>
</head>
<style>
body {
background-color:#D4E6F1;
}
</style>
<body>
<img src="http://i.imgur.com/wqfHrmJ.png?1" style= "display: block;
margin-left: auto; margin-right: auto;"/>
<div class="container-fluid" ng-controller="grocceryCtrl">
<font color='#D68910'>
<h1 class="header"> Mighty's Groceries </h1>
<div ng-show="!login">
<p align="center"><input type="text" placeholder="Enter Username" ng-model="Username" color="red" class="form-control" style="width: 500px;" /></p>
<p align="center"><input type="password" placeholder="Enter Password" ng-model="Password" class="form-control" style="width: 500px;" /></p>
<p align="center">
<button class="btn btn-primary" ng-click = "checkLogin()">Login</button>
</p>
</div>
main.js
(function() {
var secretEmptyKey = '[$empty$]'
app.controller('grocceryCtrl', function($scope) {
$scope.selected = undefined;
$scope.storeProductArray = storeProductArray;
var maxNumProducts = 15;
var discountAmt = 5;
$scope.purchasedProductArray = [];
$scope.totalAmt = 0;
$scope.login = false;
$scope.checkLogin = function() {
if($scope.username == "admin" && $scope.password == "admin") {
alert("Login Successful!!");
$scope.login = true;
}
else {
alert("Invalid User name or Password")
}
}
我雖然出於某種原因。它不會讓我登錄任何解決方案。 我曾嘗試更改密碼和用戶名。我無法弄清楚。
謝謝你Adriani6。沒有你指出,我不會注意到這麼小的錯誤。還有一個想法是如何改變按鈕的顏色? –
@MoogicalCow查看我的編輯。 – Adriani6