durandal

Combining parameters, splat routes and child routers

谁说我不能喝 提交于 2019-12-13 12:21:26
问题 We are trying to use route parameters alongside splat routes. This is the scenario. We have a navigation menu, and then as part of one of the options, we have a wizard. When we go to the wizard, we want to pass the identifier for the object we are working on. At the same, the wizard has steps and we want to handle those at the child level router, passing also the step as part of the route (*details). The splat route looks like this: { route: 'offer/:offerId/*details', moduleId: 'offerbuilder

Multiple Shells (views and view models) and routers for different type of users in Durandal

扶醉桌前 提交于 2019-12-13 06:59:06
问题 So I'm trying to build an app that has two different kind of users, namely customers and sellers. The app is designed in such a way that both of them will have different kind of navigation bars and access to different kind of pages via routes. As such, I'm trying to see what is the best way to achieve this? I'm thinking of either of the following solutions: 1. using compose binding or areas in my shell.html and by having a container and based on a certain condition, the correct specific view

Is it possible to inject a Durandal widget after the page has been composed?

限于喜欢 提交于 2019-12-13 04:49:39
问题 I am working on a durandal application and depending on certain action, I would need to inject a widget using <!-- ko widget: {kind:'widget/cards'} --><!-- /ko --> At the moment the widget is not shown but only the comment can be seen in the HTML content. Any help? Thanks 回答1: Yes. Use the if or visible binding on the immediate parent node of your widget binding. If there is no immediate parent node, create one solely for the purpose of holding the if or visible binding. Take at this code

Durandal composition foreach

一个人想着一个人 提交于 2019-12-13 04:27:24
问题 I'm looping through an array and displaying its content through a composition <!-- ko foreach: { data: datas} --> <div> <!-- ko compose: { model: 'show', activationData: { bundle:bundle }, } --> <!-- /ko --> </div> <!-- /ko --> the composition calls a model show.js, that takes the activationData bundle wraps it in an observable and display it in a table function (logger, utils) { var bundle = ko.observable(); var activate = function (data) { // process data.bundle further bundle

Why is my KO bindings need parentheses?

谁说我不能喝 提交于 2019-12-13 04:23:13
问题 I'm developing a website using Durandal/Knockout/Breeze/WebApi with MVC4 as the back end. I'm querying my api via breeze like so: var getCategories = function() { var query = entityQuery .from('Categories') .orderBy('Order'); return manager.executeQuery(query); }; Then, on my view model: function initCategories() { service.getCategories() .then(querySuccess) .fail(queryFail); function querySuccess(data) { vm.categories(data.results); }; where vm is my bounded view model and categories is of

Insert script tag in Durandal

一笑奈何 提交于 2019-12-12 15:29:40
问题 I am a bit struggling with what should be an easy task. I want to insert a script tag inside a div tag. The problem is that Durandal (for a reason that I still need to understand) seems to ignore those tags. This problem has been described here, but the solution proposed there does not work for me. how to stop durandal / jquery stripping out script tags from views? Isn't there a simple way to tell Durandal to please interpret my script tags? This is becoming very frustrating, and besides the

How to use Durandal's createChildRouter

假装没事ソ 提交于 2019-12-12 10:17:43
问题 I have struggled all day unable to figure out how to properly create a child router using Durandal in my hot towel-based (MVC4 SPA) project. This is what I have at the moment: shell.js var routes = [ { route: '', moduleId: 'home', title: 'Home', nav: 1 }, { route: 'inventory/index', moduleId: 'inventory/inventory', title: 'Inventory', nav: 2 }]; return router.makeRelative({ moduleId: 'viewmodels' }) // router will look here for viewmodels by convention .map(routes) // Map the routes

JQuery doesn't locate DOM elements when using Durandal's compose

浪尽此生 提交于 2019-12-12 07:39:05
问题 I've recently ported my company's project to Durandal using Knockout and JQuery. Straight to the problem: I need to initialize JQuery UI's datepicker using two HTML inputs. JQuery, however, is unable to locate the inputs when I do this: view: <div data-bind="if: !CurrentUser()"> <h1 data-bind="html: DisplayName"></h1> <div data-bind="compose: 'users/_UsersList.html'"></div> </div> <div data-bind="with: CurrentUser(), visible: CurrentUser()"> <h1>User detail</h1> <div data-bind="compose:

Durandal routing issue

為{幸葍}努か 提交于 2019-12-12 05:48:36
问题 I have small SPA test app with Durandal. Also I have very wired issue. First, my folder structure is: App --durandal --viewmodels ----user.js --views ----user.html --main.js And when structure is like that all works just fine. But if I create structure like App --durandal --_user ----viewmodels ------user.js ----views ------user.html I get error like localhost/App/_users/ viewmodels /users.html 404 Not Found. And that happens after user.js are loaded by require.js. my main.js looks like

Issue with Highcharts not rendering in Durandal/Hot Towel Template

一世执手 提交于 2019-12-12 05:09:58
问题 We're using HighCharts.js in a Durandal/Hot Towel template in ASP.NET MVC 4. We are simply showing a proof of concept in using a charting API for a dashboard page. However, the graph is not rendering on the page during page load. We have a custom .js file that holds the following code (copied and pasted from HighCharts.com): $(document).ready(function () { $('#reportgraph').highcharts({ chart: { type: 'bar' }, title: { text: 'Fruit Consumption' }, xAxis: { categories: ['Apples', 'Bananas',