我正在尝试将我的JavaScript数据绑定到我的HTML。它现在不起作用,我不知道为什么。我找不到任何涵盖我的确切设置的在线指南。我想我可能需要一个.observable。谢谢。
HTML5
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link href="kendo/styles/kendo.mobile.all.min.css" rel="stylesheet" />
<link href="styles/main.css" rel="stylesheet" />
<script src="cordova.js"></script>
<script src="kendo/js/jquery.min.js"></script>
<script src="kendo/js/kendo.mobile.min.js"></script>
<script src="scripts/app.js"></script>
<!--<script src="scripts/Helper.js"></script>-->
<script src="scripts/bpageVM05.js"></script>
</head>
<body>
<div data-role="layout" data-id="main">
<div data-role="header">
<div data-role="navbar">
<span data-role="view-title"></span>
</div>
</div>
<div data-role="footer">
<div data-role="tabstrip">
<a href="views/home.html" data-icon="home">Home</a>
<a data-bind="attr: { href: url }" data-icon="reply">Back</a>
<!--<a href="#" data-icon="reply" onclick="history.go(-1);return false;">Back</a>-->
</div>
</div>
</div>
</body>
</html>
的JavaScript
(function () {
/*kendo.bind($('body'), mainVM);
LoadParameters(mainVM);
// initialize data
initializeinputs();*/
// store a reference to the application object that will be created
// later on so that we can use it if need be
var app;
// HTML files: create an object to store the models for each view
window.APP =
{
models:
{
// Menu -------------------------------------
home: {
title: 'Home',
url: 'views/home.html'
},
menu: {
title: 'Main Menu',
url: 'views/home.html'
},
cards: {
title: 'Cards',
url: 'views/menu.html'
},
email: {
title: 'Email Settings',
url: 'views/menu.html'
},
rates: {
title: 'Card Rates',
url: 'views/menu.html'
},
station: {
title: 'Station Schedule',
url: 'views/menu.html'
},
parameters: {
title: 'PLC Parameters',
url: 'views/menu.html'
},
// Reports ----------------------------------
reports: {
title: 'Reports',
url: 'views/home.html'
},
reports_activity: {
title: 'Activity Report',
url: 'views/reports.html'
},
reports_payments: {
title: 'Payments Report',
url: 'views/reports.html'
},
reports_cards: {
title: 'Cards Report',
url: 'views/reports.html'
},
reports_printer_1: {
title: 'Volume Dispensed Log',
url: 'views/reports.html'
},
reports_printer_2: {
title: 'Credit Charges Log',
url: 'views/reports.html'
},
reports_printer_3: {
title: 'Accountable Volume Log',
url: 'views/reports.html'
},
reports_printer_4: {
title: 'Card Numbers Log',
url: 'views/reports.html'
}
}
}
// this function is called by Cordova when the application is loaded by the device
document.addEventListener('deviceready', function () {
// hide the splash screen as soon as the app is ready. otherwise
// Cordova will wait 5 very long seconds to do it for you.
navigator.splashscreen.hide();
app = new kendo.mobile.Application(document.body, {
// you can change the default transition (slide, zoom or fade)
transition: 'slide',
// comment out the following line to get a UI which matches the look
// and feel of the operating system
skin: 'flat',
// the application needs to know which view to load first
initial: 'views/home.html'
});
}, false);
}());