durandal

Session Data with Durandal

回眸只為那壹抹淺笑 提交于 2019-11-28 06:39:54
问题 I am just getting started with Durandal.js so excuse me for the silly quesstion... When a user makes it's first request to the app it is asked to choose a 'profile kind', and I need it to be accessible to every other view model in the web site, I first though of creating this property in the shell viewmodel, but don't how to do it. How is the best way to store data in a Session like mode in a Durandal SPA? Thanks! 回答1: Create an amd module for what data you need to store. Then just require

How to use partial views with Durandal.js, mvc3

笑着哭i 提交于 2019-11-28 04:49:09
问题 I noticed all of the views in the App/views folder are of type html, not cshtml. How do I use PartialViews and mvc3 things that I am accustomed to such as razor? 回答1: Durandal is designed for creating an application that lives entirely inside of one page. The benifits of this is the user experience is that like of a desktop application. Also, this allows the application to easily be ported to phonegap where it can live as a native mobile application or even ported to a desktop application

how to stop durandal / jquery stripping out script tags from views?

我只是一个虾纸丫 提交于 2019-11-28 04:38:07
问题 I know there are better patterns but in this case there's some legacy code that we'd like to move to a view. This html has a <script src="binding.js"></script> that needs to run after the page renders and displays. I hoped to do this with a <script src=""> tag, but the tag seems to be getting stripped out. How do we either get the script tag to render, or do a work-around with durandal? Example html: <div> <link rel="stylesheet" href="/Content/stylesheet1.css"/> <link rel="stylesheet" href="

How to use dropdowns for Durandal navigation?

拈花ヽ惹草 提交于 2019-11-28 03:38:29
问题 I've just started working with Durandal and all the pieces are falling into place, and am using the Hot Towel template to speed things up. One thing that stumps me is how to create a more complex hierarchical navigation system than a buttongroup. Here's what I want to end up with: A B C A1 B1 C1 A2 B2 C2 A, B, and C are the top-level menus that have no routes attached to them - they are simply placeholders. I will have views and viewmodels for A1, A2, B1, B2, C1, and C2 and need those hash

Durandal.js: change navigation options per area

左心房为你撑大大i 提交于 2019-11-27 16:50:17
问题 I want to have different navigation per "area" of my durandal application. I've achieved this with ASP.NET MVC when using Areas by defining a Nav section in the layout page and having nested layout pages which implement the nav for each area. The view structure in durandal is as follows: http://i1346.photobucket.com/albums/p697/user2269352/viewstructure_zps5e21e724.gif I'm using the ASP.NET MVC4 durandal template and I am guessing that I might need to change the following segement from shell

Durandal Subrouting (Hottowel)

偶尔善良 提交于 2019-11-27 10:39:56
问题 Basically, I am trying to create a menu inside a menu. So, within a main menu route, there will be a vertical menu with another set of routes. When clicking on the submenu routes, only a part of the page gets updated, and the vertical menu does not reload. I am guessing it would be similar to this KO fiddle http://jsfiddle.net/dPCjM/, but there would need to another set of "ghost" KO directives in a main route view: <!--ko compose: {model: router.activeItem, afterCompose: router.afterCompose,

How can I use cshtml files with Durandal?

自闭症网瘾萝莉.ら 提交于 2019-11-27 06:46:18
I got the DurandalJS StarterKit template on VS2012... All works great... But in some views I need to do something like that: @if (Roles.IsUserInRole("Administrators")) { <p>Test</p> } However with durandal all my views are '.html' files... Is that possible to use '.cshtml' files to access some information like that? Or is there any other way to do that with durandal? Junior Yes, you can absolutely use cshtml files with Durandal and take advantage of Razor on the server. I assume that also means you want MVC, so you can do that too and use its routing. If you don;t want the routing then you can

How to make a SPA SEO crawlable?

人走茶凉 提交于 2019-11-26 21:08:22
I've been working on how to make a SPA crawlable by google based on google's instructions . Even though there are quite a few general explanations I couldn't find anywhere a more thorough step-by-step tutorial with actual examples. After having finished this I would like to share my solution so that others may also make use of it and possibly improve it further. I am using MVC with Webapi controllers, and Phantomjs on the server side, and Durandal on the client side with push-state enabled; I also use Breezejs for client-server data interaction, all of which I strongly recommend, but I'll try

How can I use cshtml files with Durandal?

こ雲淡風輕ζ 提交于 2019-11-26 12:09:30
问题 I got the DurandalJS StarterKit template on VS2012... All works great... But in some views I need to do something like that: @if (Roles.IsUserInRole(\"Administrators\")) { <p>Test</p> } However with durandal all my views are \'.html\' files... Is that possible to use \'.cshtml\' files to access some information like that? Or is there any other way to do that with durandal? Junior 回答1: Yes, you can absolutely use cshtml files with Durandal and take advantage of Razor on the server. I assume

How to make a SPA SEO crawlable?

无人久伴 提交于 2019-11-26 07:52:05
问题 I\'ve been working on how to make a SPA crawlable by google based on google\'s instructions. Even though there are quite a few general explanations I couldn\'t find anywhere a more thorough step-by-step tutorial with actual examples. After having finished this I would like to share my solution so that others may also make use of it and possibly improve it further. I am using MVC with Webapi controllers, and Phantomjs on the server side, and Durandal on the client side with push-state enabled;