非常感谢帮助。我可能已经访问了有关Stack Overflow上$ routeProvider的每一个答案,回顾了AngularJS API文档,参考了我阅读以学习Angular的书 - 并且在找到了5种不同的方法之后(没有一个工作) ,我告诉你以下内容:
<!DOCTYPE html>
<html lang="en" ng-app="ticketRegister">
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
<script src="https://code.angularjs.org/1.2.22/angular-route.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="tickReg.css" />
<script src="tickReg.js"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>EWCC Ticket Register v2.0 by P.A.Pirault</title>
</head>
<body>
<h1>EWCC</h1>
<h2>ticket register</h2>
<h3 class="pull-right">version 2.0</h3>
<br />
<br />
<div class="well well-lg" ng-view>
<a href="#/Calculator">Calculator</a>
</div>
</body>
</html>
tickReg.js
var tickReg = angular.module('ticketRegister', ['ngRoute']);
tickReg.config(changeMode);
function changeMode($routeProvider)
{
$routeProvider.
when('/Calculator', {
controller: ticketCalculatorController,
templateUrl: 'Calculator.html'
}).
when('/DB', {
controller: ticketDBController,
templateUrl: 'DB.html'
}).
otherwise({
redirectTo: '/'
});
}
function ticketCalculatorController($scope)
{
$scope.price =
{
ppA : 13.95,
ppC : 6.95,
ppD : 2.50,
discountPercent : 0.2,
gratuityPercent : 0.17,
taxPercent : 0.06
};
$scope.guests =
{
adults : 0,
children : 0,
drinks : 0,
server : undefined
};
$scope.bill =
{
subtotal : 0,
total : 0,
discount : "no",
discountAMT : 0,
gratuityAMT : 0,
tax : 0
};
$scope.updateTotals = function()
{
price = $scope.price;
guests = $scope.guests;
bill = $scope.bill;
bill.subtotal = price.ppA * guests.adults;
bill.subtotal += price.ppC * guests.children;
bill.subtotal += price.ppD * guests.drinks;
if(bill.discount == "yes")
{
bill.discountAMT = bill.subtotal * price.discountPercent;
}
if(parseInt(guests.adults) + parseInt(guests.children) > 5)
{
bill.gratuityAMT = bill.subtotal * price.gratuityPercent;
}
bill.tax = (bill.subtotal - bill.discountAMT) * price.taxPercent;
//TOTAL
bill.total = bill.subtotal - bill.discountAMT - bill.gratuityAMT + bill.tax;
};
}
答案 0 :(得分:0)
原来还没有定义ticketDBController的问题。所以我刚刚创建了一个空函数,我至少从这个东西中得到了一些生命!现在,让它不要去&#39; /#/&#39;而不只是&#39; /&#39; ....