durandal

How to open a new tab with router.navigate in TypeScript

守給你的承諾、 提交于 2019-12-21 15:06:08
问题 The following typescript code will always open in the current browser tab navigate($data: menuItem, $event: JQueryEventObject) { //... let a = $event.currentTarget as HTMLAnchorElement; router.navigate(a.href); } How do I make router.navigate open in a new tab ? (that is when $event.ctrlKey is true) 回答1: Yes, as you @Daneille commented, you have to handle by your own way since durandal's router plugin (navigate function) does not provide a way to open a new tab. So it is better to handle

How to open a new tab with router.navigate in TypeScript

こ雲淡風輕ζ 提交于 2019-12-21 15:03:00
问题 The following typescript code will always open in the current browser tab navigate($data: menuItem, $event: JQueryEventObject) { //... let a = $event.currentTarget as HTMLAnchorElement; router.navigate(a.href); } How do I make router.navigate open in a new tab ? (that is when $event.ctrlKey is true) 回答1: Yes, as you @Daneille commented, you have to handle by your own way since durandal's router plugin (navigate function) does not provide a way to open a new tab. So it is better to handle

Translating views with HotTowel (Durandal framework) + VS2012

徘徊边缘 提交于 2019-12-20 14:39:57
问题 I develop an ASP.NET MVC solution with Durandal and Breeze. I need to translate frontend to french and dutch. How to proceed with Durandal/knockout? In a classic ASP.NET MVC solution we have the opportunity to have the views rendered server side (thanks to razor). Thanks for your help. 回答1: To expand on Rob's answer of trying the i18n.js plugin for require.js, here's the steps I followed (I'm working off the Durandal starter template in Visual Studio). Download the i18n.js plugin and put it

Durandal login page redirect pattern

爱⌒轻易说出口 提交于 2019-12-20 09:03:30
问题 TL;DR What is a good pattern for requiring a user to login in order to view certain pages in a Durandal Single Page Application (SPA)? I need a system whereby if a user attempts to navigate to a "page" that requires them to be logged in, they are instead redirected to a login page. Upon successfully authenticating on this login page, I would then like the application to redirect them to the page that they previously attempted to access before they were redirected to the login page. One method

Durundal Google Translate

心不动则不痛 提交于 2019-12-20 06:36:28
问题 How can I bind Google translate in Durundal Shell.js , shell.html? html <div id="google_translate_element"></div> script <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'en', autoDisplay: false }, 'google_translate_element'); } 回答1: Durandal doesn't render script tags within views. To render them, you should use knockout

Durandal 2.0 custom dialog

北慕城南 提交于 2019-12-19 03:20:49
问题 I wish to make a Durandal custom dialog that adds a window frame with title and footer around an existing composable viewmodel. I have made a customModal.html template <div class="messageBox"> <div class="modal-header"> <h3 data-bind="text: title"></h3> </div> <div class="modal-body"> <!--ko compose: { model: model, template: view }--> <!--/ko--> </div> <div class="modal-footer" data-bind="foreach: options"> <button class="btn" data-bind="click: function () { $parent.selectOption($data); },

HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory

时光怂恿深爱的人放手 提交于 2019-12-17 18:59:08
问题 After finishing the John Papa course on Pluralsight- which is AWESOME by the way!!! ) I'm now creating my first SPA. I come from Desktop Application Developer background so excuse me if this question is newbie! When I load the SPA instead of seeing the splash screen and then the main screen I'm getting this error message: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.Most likely causes: A default document is not configured for the

Setting breakpoints in viewmodels in Durandal

烈酒焚心 提交于 2019-12-13 23:36:24
问题 How do I use Google Chrome's (F12) feature to set breakpoints in Durandal's viewmodels? 回答1: Load the page you want to debug Hit F12 in Chrome click on the 'Sources' tab In the pane on the left you should be able to see all your different view model js files Choose one of the js files by clicking on it Set a breakpoint by clicking on the code line number in the source code view You can refresh the browser page and your breakpoints will remain intact 来源: https://stackoverflow.com/questions

Programmatically closing a Durandal modal

懵懂的女人 提交于 2019-12-13 19:04:00
问题 I'm new to Durandal, so I might be taking the wrong approach to my problem. I want to show a modal popup with a message of 'logging in...please wait' when the user has clicked the login button. I want to close the modal popup once the response is received. My attempted approach is to call a custom modal popup using Durandal's app.showModal and a view with no buttons, from the login view model. This shows the modal popup I'm after, but I haven't been able to figure out how to close the popup

Ignore an anchor in DurandalJS app

对着背影说爱祢 提交于 2019-12-13 14:23:35
问题 I have an SPA app using DurandalJS that works great. Links are routed, view models are activated, etc. The problem is, I have an anchor that points to a page that actually lives on the server. I need the browser to actually query this page (it's an asp.net MVC page). It seems the router in Durandal hooks into all links that are relative (or on the same domain, really) and if it finds no route, calls the handleInvalidRoute method of router. I cannot for the life of me figure out how to tell