single-page-application

Conditional routing in Durandal

我与影子孤独终老i 提交于 2019-12-07 18:48:36
问题 In my HotTowel based project, I'm using Durandal 1.1.1 for routing. I have a login route, which I want to activate if the user is not logged in. my route config is like: var routes = [ { url: 'login', moduleId: 'viewmodels/login', name: 'Login', visible: true, caption: 'Login' },{ url: 'moduledetail/:id', moduleId: 'viewmodels/moduledetail', name: 'ModuleDetail', visible: true, caption: 'ModuleDetail' } I want if user want to go #/moduledetail/1 and is not authenticated yet, the browser

Is it Possible Webmatrix CRUD in Same Page Using Ajax

余生颓废 提交于 2019-12-07 12:19:59
问题 I would like to get idea about, what is the fastest and secure way to make CRUD operations (Update-Edit-insert) in samepage with Ajax in WebMatrix Razor Syntax. Is it possible to do this CRUD Operations in same razor page with ajax without GET-POST webservice or other razor page? I tried using jquery ajax to Post-Get data from other Razor pages with Output type Json and also using WCF Webservice. But they didnt really satisfy me, because in all i need another page to serve my data. 回答1: Yes,

DurandalJS Routing Behavior

半城伤御伤魂 提交于 2019-12-07 10:04:07
问题 What I Have Trying to understand what's going on and how to control it. I have a "public" view for users that have not yet been authenticated, and a "home" view for users that are authenticated. Here's my route config: app.start().then(function() { //Replace 'viewmodels' in the moduleId with 'views' to locate the view. //Look for partial views in a 'views' folder in the root. viewLocator.useConvention(); //configure routing router.useConvention(); router.mapRoute('home', 'viewmodels/home',

Breeze entities with typescript

老子叫甜甜 提交于 2019-12-07 08:07:45
问题 I'm using Breeze + Typescript + Knockout for a Spa, and I'm facing the following problem: when I create a new entity with EntityManager.createEntity, typescript doesn't let me use the observables that Breeze generates from metadata. Typescript "sees" only the "entityAspect" and the "entityType" properties. I'm using the type definitions of DefinitelyTyped. Any help is greatly appreciated! 回答1: You can create an interface for your type which extends breeze.Entity : /// <reference path="breeze

Sequence of componentWillMount calls in React.js

六眼飞鱼酱① 提交于 2019-12-07 03:28:43
问题 According to this page http://busypeoples.github.io/post/react-component-lifecycle/ The render method for a component is called right in between the componentWillMount and componentDidMount methods amongst other places. But the react.js documentation for component lifecycles here https://facebook.github.io/react/docs/component-specs.html says that the componentDidMount methods of all child activities are called before the parent. I can understand that componentDidMount is ok to call after any

Sails js route static html

扶醉桌前 提交于 2019-12-07 00:07:34
I want to completely separate the client and server sides in my sails js app. If I remove the '/' route, automatically it will serve a file named index.html from the 'assets' folder. I want to serve another file from the assets folder, how can I do it? hawkcurry If you look at the middlewares that sails uses config/http.js order: [ 'startRequestTimer', 'cookieParser', 'session', 'myRequestLogger', 'bodyParser', 'handleBodyParserError', 'compress', 'methodOverride', 'poweredBy', '$custom', 'router', 'www', 'favicon', '404', '500' ], We can see that it tries to match the current request with the

Should I use a button or a link if the URL doesn't change?

让人想犯罪 __ 提交于 2019-12-06 22:26:42
I'm building an app which works only with JavaScript enabled (otherwise, an appropriate message is displayed). There are a couple of screens in the app: game, tutorial, settings, about/credits. They look like separate pages, but it's all a single-page app. There are no URL changes when navigating between the screens. Should I use a button or an anchor in this case? It feels like an anchor, but there's no page to lead to, meaning that href would have to be # . Also an anchor will break common patterns such as opening in new tab/window (no URL change means the app will restart from scratch in a

Are server-side MVC frameworks still relevant in single-page applications? [closed]

荒凉一梦 提交于 2019-12-06 21:57:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . In a single-page application that uses Angular, it seems like most of the things are handled on the client-side. The client seems to just make restful calls to the server. Following this concept, it seems to me that my server-side will not have any application at all, but only

what is {version} in ScriptBundle(“~/scripts/jquery-{version}.js”)

旧时模样 提交于 2019-12-06 17:21:42
问题 I try to get started with MVC SPA apps, and I noticed in BundleConfig the following: ScriptBundle("~/scripts/jquery-{version}.js") How this works? What is {version} and where it it taken from? And where can find more information this, how BundleConfig works and how to customize it? Thanks 回答1: See the answers to this question. Also, check out this link. The Bundling and Optimization section discusses the use of the {version} tag. 回答2: It allows you to indicate a version number format (semver)

Option url path UI-Router

微笑、不失礼 提交于 2019-12-06 16:19:10
In my angular application, I am making heavy use of nested states with UI-Router. I am trying to create a parent state that determines the locale of the application based on a URL that has an optional locale path. For Spanish www.website.com/es/search For English www.website.com/search the '/es' is required for Spanish, but English is implied by the parameter missing and I would prefer to not have the '/en' . I want any child state of this one to inherit that locale value. $stateProvider .state('localization', { abstract: true, url: '/:locale?', params: { locale: { value: 'en' } } }) .state(