durandal

MVC Authentication and Antiforgery token with Durandal SPA template

孤者浪人 提交于 2019-12-03 01:43:12
问题 Some areas of my SPA need to be open to all users, and some areas require authentication. In these areas, it's the data loaded via AJAX that I want to protect. I have an authentication service (see below), which I add as a dependency in my durandal main.js . The service is called: authentication In my main.js I call authentication.handleUnauthorizedAjaxRequest(function () { app.showMessage('You are not authorized, please login') .then(function () { router.navigateTo('#/user/login'); }); });

How to reference the bundled js files (asp.net mvc4) in Require.js?

不羁的心 提交于 2019-12-03 00:45:54
I have been studying John Papa's pluralsight course on SPA. In his main.js , he gave a name to each js library which is included in the bundle. (function () { var root = this; define3rdPartyModules(); function define3rdPartyModules() { // These are already loaded via bundles. // We define them and put them in the root object. define('jquery', [], function () { return root.jQuery; }); define('ko', [], function () { return root.ko; }); define('amplify', [], function () { return root.amplify; }); define('infuser', [], function () { return root.infuser; }); define('moment', [], function () {

Parallel.js have problems with Blob in IE

你。 提交于 2019-12-02 18:28:12
问题 I need to execute functions in "parallel" and I use parallel.js : var p = new Parallel(items); var fn1 = function (item) { doSomething(item); }; p.map(fn1).then(function () { otherFunction(); }); But IE shows the following error: [Q] Unhandled rejection reasons (should be empty): (no stack) SecurityError HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed. How to fix this

Durandal (knockout) app with multilanguage support

喜夏-厌秋 提交于 2019-12-02 18:24:16
I am building multilingual support for the app I'm working on. After doing some research and reading SO ( internationalization best practice ) I am trying to integrate that in a 'framework-friendly' way. What I have done at the moment is following: Created .resource modules formatted like so: resources.en-US.js define(function () { return { helloWorlLabelText: "Hello world!" } }); On the app.start I get the resource module with requirejs and assign all data to app.resources. Inside of each module specific resource is assigned to observables and bonded with text binding to labels and other text

MVC Authentication and Antiforgery token with Durandal SPA template

为君一笑 提交于 2019-12-02 15:10:46
Some areas of my SPA need to be open to all users, and some areas require authentication. In these areas, it's the data loaded via AJAX that I want to protect. I have an authentication service (see below), which I add as a dependency in my durandal main.js . The service is called: authentication In my main.js I call authentication.handleUnauthorizedAjaxRequest(function () { app.showMessage('You are not authorized, please login') .then(function () { router.navigateTo('#/user/login'); }); }); It warns the user they are not authorized, and navigates user to a login view/viewmodel where they can

Durandal SPA issues with typescript

流过昼夜 提交于 2019-12-02 08:12:19
I am updated my durandal SPA application from VS_2012 to VS_2015 with TypeScript 1.8 which will generate JavaScript (ECMA5). I resolved all build errors.But I am unable to fix one typescript error called "A 'return' statement can only be used within a function body" I am working on view models. So I need return statement out side of function. Due to build error I am not able to generate my java-script. Below is my sample code in Type script: class typescript1_8{ constructor(){ } } return new typescript1_8(); Java Script code needs to generate like below: var typescript1_8 = (function () {

Parallel.js have problems with Blob in IE

痴心易碎 提交于 2019-12-02 07:47:48
I need to execute functions in "parallel" and I use parallel.js : var p = new Parallel(items); var fn1 = function (item) { doSomething(item); }; p.map(fn1).then(function () { otherFunction(); }); But IE shows the following error: [Q] Unhandled rejection reasons (should be empty): (no stack) SecurityError HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed. How to fix this error? I had review parallel.js page in IE and all examples work fine. I use Durandal, Breeze and Knockout

Incorrect this in select

大兔子大兔子 提交于 2019-12-02 06:00:09
问题 I'm trying to use typescript with Durandal. I'm trying to make starter example working with typescript, which works for most methods and classes. However in the Flickr class below I experience a problem in the select method. When this method is called it seems that this is not the Flickr class, but the selected item. Can someone help me figure out what is wrong ? The other methods are working as expected. Kind regards, Marwijn ///<reference path='../../Scripts/typings/requirejs/require.d.ts'/

Knockout date validation not working correctly

冷暖自知 提交于 2019-12-02 04:03:21
I need to validate date in localized format (SK) and it is not possible with knockout validation. I am using: Durandal 1.2.0 Knockout 2.3.0 Knockout validation https://github.com/Knockout-Contrib/Knockout-Validation I need something like this to be working: var newStartDate = ko.observable() .extend({ required: { message: 'Start date is required.' }, date: true, formattedDate: { format: 'ddMMyyyy', delimiter: '.' } }); Then if I call newStartDate.isValid() I get these results: newStartDate(""); false (OK) newStartDate("test"); false (OK) newStartDate("2013-02-02"); true (Bad) newStartDate("2.2

Incorrect this in select

被刻印的时光 ゝ 提交于 2019-12-02 01:33:00
I'm trying to use typescript with Durandal. I'm trying to make starter example working with typescript, which works for most methods and classes. However in the Flickr class below I experience a problem in the select method. When this method is called it seems that this is not the Flickr class, but the selected item. Can someone help me figure out what is wrong ? The other methods are working as expected. Kind regards, Marwijn ///<reference path='../../Scripts/typings/requirejs/require.d.ts'/> ///<reference path='../../Scripts/typings/durandal/durandal.d.ts'/> ///<reference path='../../Scripts