我已经制作了几个淘汰赛 ViewModel,现在我正试图将它们绑定到一个 ViewModel,但这不能正常工作!
它应该像导航一样工作。如果 LoginModel 完成,它应该跳到 start Model!
我不知道这是怎么做到的
这该怎么做?
<!-- Login Seite -->
<form data-bind="visible: userNotLoggedIn" action="" data-role="page" id="Login">
//Some code
</form>
<!-- ---------------------------------- -->
<!-- Start Seite -->
<form data-bind="visible: showStart" action="" data-role="page" id="pageStart">
//Some Code
</form>
<!-- --------------------------------------------------------------------- -->
<!-- Projekt Details-->
<form data-bind="visible: showDetails" action="" data-role="page" id="pageDetails">
// SOME CODE
</form>
</body>
<script type="text/javascript">
$('#Login').live('pageinit', function (event) {
ko.applyBindings(new LoginViewModel(), document.getElementById('Login'));
});
$('#pageStart').live('pageinit', function (event) {
alert("Hallo");
ko.applyBindings(new StartViewModel(), document.getElementById('pageStart'));
});
$('#pageDetails').live('pageinit', function (event) {
alert("Hallo");
ko.applyBindings(new DetailsViewModel(),document.getElementById('pageDetails'));
});
</script>
Javascript for Knockout ViewModels:
function LoginViewModel() { //Some Code }
function StartViewModel() { //Some Code }
function DetailsViewModel() { //Some Code}