-1
我已經寫shell.js路線登錄從shell.js頁迪朗達爾
define(['plugins/router', 'durandal/app'], function (router, app) {
return {
router: router,
activate: function() {
router.map([
{ route: 'login', title: 'login', moduleId: 'viewmodels/login', nav: true }
]).buildNavigationModel();
return router.activate();
}
};
});
和shell.html
<div>
<nav role="navigation">
<div>
<ul data-bind="foreach: router.navigationModel">
<li data-bind="css: { active: isActive }">
<a data-bind="attr: { href: hash }, text: title"></a>
</li>
</ul>
</div>
</nav>
<div class="page-host" data-bind="router: { transition:'entrance' }"></div>
我login.js是
define(['require', 'knockout', 'durandal/system', 'durandal/app', 'plugins/router', 'jquery'],
function (require, ko, system, app, router, $) {
var loginVM = function() {
var self = this;
self.username = ko.observable();
self.password = ko.observable();
};
return loginVM;
});
和login.html的是
<div id="openModal">
<div>
<h4>Please login to proceed</h4>
<div class="row">
<div>
<label for="Username">Username:</label>
<input type="text" id="Username" data-bind="value: userName, hasFocus: setFocus" />
</div>
</div>
<div>
<div>
<label for="Password">Password:</label>
<input type="password" id="Password" data-bind="value: password">
</div>
</div>
<div>
<button id="login" onclick="Users.login()" type="submit" data-bind="click: login, disable: session.isBusy()">Log in</button>
</div>
<p id="warning" class="warning">Invalid username or password !!!</p>
</div>
我試圖從外殼打開登錄頁面。任何人都可以幫助我,如果我做任何事情都是錯誤的,因爲登錄頁面在shell之後沒有加載。
控制檯中是否有任何錯誤? – nemesv
沒有@nemesv它顯示沒有錯誤,控制檯正在顯示導航發生。 –
我得到一個shell之前說錯了scripterror的錯誤 - 未處理的異常在32行,第43列在http:// localhost:63625/lib/require/require.js中 0x800a139e - JavaScript運行時錯誤:腳本錯誤 http://requirejs.org/docs/errors.html#scripterror –