durandal

Perform a select and expand in the same query with breeze is not supported

二次信任 提交于 2020-01-01 11:45:08
问题 I develop an asp.net solution with Durandal/breeze. Here is my code to get all my shippers: var query = EntityQuery.from('Shippers') .select('id, name, street, city'); return manager.executeQuery(query) .then(querySucceeded) .fail(queryFailed); Here is the related model: public class Shipper { [Key] public int Id { get; set; } public string Name { get; set; } public string Street { get; set; } public string Number { get; set; } public City City { get; set; } } public class City { public int

View Model inheritance when using Durandal

扶醉桌前 提交于 2020-01-01 07:01:10
问题 I am building an application using Durandal and I have the need to share some functionality across view models. I have 5 screens to build and they are all virtually the same screen except that in the activate function they will call to a different api end points but otherwise the view and view models will be identical. Is there a pattern that I should be following to structure this correctly to promote code reuse? 回答1: If the views and the view models are identical except for calling

Durandal and ASP.NET MVC conventions

帅比萌擦擦* 提交于 2020-01-01 01:54:08
问题 I'm currently evaluating Durandal for use in an enterprise ASP.NET MVC application. However the default conventions used by Durandal seem to conflict with the MVC conventions I've grown accustomed to. The HotTowel MVC template by John Papa is great, but this too seems to "do away" with MVC conventions in favour of Durandals by putting things in an App folder. A couple of the issues I have with these conventions are: Views are potentially split across two locations (/App/views and /Views).

Durandal.js optimizer not working (empty main-built.js)

帅比萌擦擦* 提交于 2019-12-31 03:04:46
问题 I'm trying to get Durandal.js optimizer working on my test project, but it seems to generate nothing to main-built.js. I use the following command from node.js command prompt, in durandal/amd folder: optimizer.exe --verbose true Result is Using default base configuration. Configuring for deploy with almond (custom). { "name": "durandal/amd/almond-custom", "inlineText": true, "stubModules": [ "durandal/amd/text" ], "paths": { "text": "durandal/amd/text" }, "baseUrl": "C:\\Users\\Tommi

MVC Bundling - Failed to load resource

血红的双手。 提交于 2019-12-28 13:22:11
问题 What could be causing this? I'm working with a DurandalJS project that builds and runs locally just fine. When I try to deploy to an Azure Website, the app publishes but fails in the browser with: Failed to load resource: the server responded with a status of 404 (Not Found) http://appsite.azurewebsites.net/Scripts/vendor.js?v=KJCisWMhJYMzhLi_jWQXizLj9vHeNGfm_1c-uTOfBOM1 I haven't customized any of the bundling. my bundle configs: public class BundleConfig { // For more information on

AutoComplete Textbox using Durandal JS

北战南征 提交于 2019-12-25 11:04:31
问题 How can I create an autocomplete textbox using durandal JS. Given code not working. viewModel(js) define(['repositories/customerRepository', 'plugins/router', 'plugins/http', 'durandal/app', 'knockout'], function (customerRepository, router, http, app, ko) { return { router: router, activate: function () { var data = customerRepository.listMovies(); $(function () { $("#movie").autocomplete({ source: data, focus: function (event, ui) { $("#movie").val(ui.item.name); return false; }, select:

Knockout Validation length is always 0

这一生的挚爱 提交于 2019-12-25 07:59:40
问题 I am new to using knockout and I am trying to get the validation plug-in to work. However, I tried ViewModel.errors().length == 0 but it is always zero when i check the isValid - I always get true. Here is the rest of my code, please help. define(['knockout','knockout-validation', 'services/changeup', 'services/currencies', 'plugins/router'], function (ko, validation, changeup, currencies, router) { ko.validation.configure({ insertMessages: true, decorateElement: true, errorElementClass:

How to disable cache view in Durandal

一个人想着一个人 提交于 2019-12-25 07:58:21
问题 I have a viewmodel: define(['knockout'], function (ko) { var self, albumWrapper; albumWrapper = function () { self = this; // get album name from url parameter var albumName = routerWrapper.router.activeInstruction().params[0]; self.retrieveAlbum(albumName); }; albumWrapper.prototype = { retrieveAlbum: function (name) { /* do something to retrieve data */ } } return new albumWrapper(); }); I config route to go to this view by this url: #gallery/album/:name But when parameter (/:name) changed

Use typings from a declared module in TypeScript

我与影子孤独终老i 提交于 2019-12-25 05:14:11
问题 I'm going through the Durandal "get started" guide on the DurandalJS.com site, except I'm trying to do it with TypeScript. The last demo (the Mount Rainier one) has a module with code like this: define(function (require) { var http = require('plugins/http'), ko = require('knockout'); //other stuff } Everything is working fine when I run the code in the browser, but I wanted to see if I could get TypeScript to be aware of the types. I imported the Durandal, Knockout, jQuery, and RequireJS

Durandal Event in widgets

丶灬走出姿态 提交于 2019-12-25 04:26:29
问题 So I have yet another DurandalJS question. So I have a few widgets that are pretty much self contained. They render or hide themselves depending on whether the current user is logged in or not e.g. I have a widget that displays the current users name, and another one that displays some setting for the current user. The 'current user is a value stored in local storage so everyone basically knows to get it from there and do their bit. I have a security module which triggers an event on itself