single-page-application

Twitter Bootstrap: Affix not triggering in single page application

a 夏天 提交于 2019-12-10 14:16:47
问题 I am doing a Single Page Application and using Twitter Bootstrap. I am trying to use the Affix like so: <div data-spy="affix" data-offset-top="100"> When I refresh the page, everything works fine, the bootstrap affix adds a class like so: <div class="affix-top" data-spy="affix" data-offset-top="100"> and after I go past 100px, it changes it to class="affix". However, if I click off this page and come back, it no longer adds any classes to my div. In fact, it does not trigger the function in

C# await / async in WebApi, what's the point?

狂风中的少年 提交于 2019-12-10 13:15:08
问题 Does anybody know what is the purpose of doing this? private async Task<bool> StoreAsync(TriviaAnswer answer) { ... } [ResponseType(typeof(TriviaAnswer))] public async Task<IHttpActionResult> Post(TriviaAnswer answer) { var isCorrect = await StoreAsync(answer); return Ok<bool>(isCorrect); } From examining this, it is telling it to run the private method asynchronously but synchronously wait for it to end. My question is, is there any point to this? Or is this just a fancy yet futile technique

How do I use Backbone.js for a multi-page web app?

时间秒杀一切 提交于 2019-12-10 13:09:45
问题 I've always used Backbone's routes (#!/blah) But I realize that in order to get indexed by Google, you need to provide a non-javascript version of the site. I don't like to write code twice. So, I would rather build a multi-page app instead of a single page web app. Backbone.js provides me with the "structure" so my javascript does not turn into sphagetti mess. But , I'm completely clueless on how to build multi-page apps using Backbone. Do you include the main.js file on every page render?

Incremental updates using browser cache

江枫思渺然 提交于 2019-12-10 12:59:09
问题 The client (an AngularJS application) gets rather big lists from the server. The lists may have hundreds or thousands of elements, which can mean a few megabytes uncompressed (and some users (admins) get much more data). I'm not planning to let the client get partial results as sorting and filtering should not bother the server. Compression works fine (factor of about 10) and as the lists don't change often, 304 NOT MODIFIED helps a lot, too. But another important optimization is missing: As

Reuse an AngularJS template between page views for the same route

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:33:09
问题 I am using a third party JS API that creates an object attached to an html element on my angular template. Each time the template is loaded I want to reuse the object already created and reattach it to the correct html element. In this plunker you can see the issue demonstrated. And here are the steps to reproduce. I really appreciate any suggests on how to preserve the first object between page loads. Thanks in advance. Problem Description To understand the problem: Tap the "Show Map" link

ASP.Net Core, Angular2 and token based authentication

社会主义新天地 提交于 2019-12-10 10:56:42
问题 I'm writing a web application using ASP.NET core for the backend / Service and Angular2 as frontend and have Troubles with authentication / authorization. In ASP.NET core I got just one html page&controller, HomeController with Index which allows anonymous Access ([AllowAnonymous]). This single page delivers the angular2-app to the Client. All other communication is using ApiControllers (which in ASP.NET core are just normal Controllers, but the Actions on these Controllers expect and send

Loading the specific page on Browser Refresh. SPA AngularJS

青春壹個敷衍的年華 提交于 2019-12-10 10:48:11
问题 I am creating a new Web API and Angular application. I want to know how we can handle routes on server side. Everything is working fine. I am using ui-router for routing, when i refresh browser that its giving me. HTTP Error 404.0 - Not Found I want to know how we can handle this. Code for ui-router $stateProvider.state('login', { url: '/', templateUrl: templatesDirectores.wmAccount + 'login.html', controller: 'login-controller', controllerAs: 'vm' }) .state('register', { url: '/register',

Durandal Widget with multiple views

家住魔仙堡 提交于 2019-12-10 10:20:00
问题 I am working on a SPA using Durandal, and I have created a widget for displaying a particular page component. Following the Durandal Documentation, the widget is in app/widgets/my-widget and is composed of viewmodel.js and view.html . Now, I want to add a different view to the same widget - in effect, to have a "Basic" view and an "Advanced" view, with a flag in the ViewModel for which one will be used. I do not want to create two different widgets, because the ViewModel is exactly the same

Angular 2 creating models vs working with json objects on the fly?

烈酒焚心 提交于 2019-12-10 06:34:15
问题 when interacting with a rest api using Angular 2. Is it worth creating typescript classes for each object (eg. employee, company, project, user ...). the other option is getting json object and working with it on the fly ? 回答1: i suggest using models because : your code will be more readable for yourself after a while coming back to change it, every one else also can easily understand what you've done making changes in project will be more easily for example obj[0] does not have any special

Load a SPA webpage via AJAX

六眼飞鱼酱① 提交于 2019-12-10 02:43:20
问题 I'm trying to fetch an entire webpage using JavaScript by plugging in the URL. However, the website is built as a Single Page Application (SPA) that uses JavaScript / backbone.js to dynamically load most of it's contents after rendering the initial response. So for example, when I route to the following address: https://connect.garmin.com/modern/activity/1915361012 And then enter this into the console (after the page has loaded): var $page = $("html") console.log("%c✔: ", "color:green;",