single-page-application

.NET core 2.1 base href tag on Angular template

为君一笑 提交于 2019-11-29 12:23:38
I'm building a template for our team on top of the .NET Core 2.1 + Angular 5 template included in the latest release of core 2.1, we deploy applications into virtual folders, for example /it/myapp, or /aa/myotherapp On the 2.0 template the base href property would be set automatically, I'm assuming because it was built with razor, like this: <base href="~/" /> However this is not true for the 2.1 template, I'm assuming it's because the template actually only uses static files, with the new app.UseSpa() Any ideas on how I could automatically populate the base href tag? Thank you Yes, I know it

AngularJS routing not working after site hosted into IIS

馋奶兔 提交于 2019-11-29 07:43:37
We are creating SPA technique using AngularJS in ASP.NET MVC framework,AngularJS routing between pages are working fine when it's run from VS2013,but after hosting the application in to IIS7.5 routing not working, Routing Script: var appRoot = angular.module('main', ['ngRoute', 'ngGrid', 'ngResource']); //Define the main module appRoot .config(['$routeProvider', function ($routeProvider) { //Setup routes to load partial templates from server. TemplateUrl is the location for the server view (Razor .cshtml view) $routeProvider .when('/home', { templateUrl: '/home/main', controller:

Angular routes contain #! in the url instead of # [duplicate]

馋奶兔 提交于 2019-11-29 03:30:08
This question already has an answer here: angularjs 1.6.0 (latest now) routes not working 5 answers Recently I have noticed that when using ngRoute module in an AngularJS app, the route contains #! in the URL, which was earlier just the # . For example, www.webiste.com/#/login becomes www.website.com/#!/login I have to enable the html5Mode and also disable the requireBase which removes the base as a whole using the code, $locationProvider.html5Mode({ enabled: true, requireBase: false }); and the URL changes to www.website.com/login which works fine but is misleading and is not what Angular SPA

Refactoring and removing unused CSS from SASS/LESS files

心不动则不痛 提交于 2019-11-29 03:03:20
问题 I am working on a big single page application [backbonejs and rails] which has LESS as the CSS preprocessor and the generated .css files has grown to such an extent that for IE we have to split it into 3 files with http://blesscss.com/ Though there are tools to detect unused css and linting css, I am unable to find a proper solution for refactoring LESS/SASS files directly from uncompiled files instead of a single large generated .css file. Would like to know what is the best approach doing

mod_rewrite to index.html breaks relative paths for deep URLs

你离开我真会死。 提交于 2019-11-29 02:46:10
For a single-page app, I have the following RewriteRule in my .htaccess file to direct all traffic to index.html so that a JS can parse the URL and fire controllers accordingly. # html5 pushstate (history) support: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !index RewriteRule (.*) index.html [L] This works fine for top level urls like, www.mydomain.com/resource but anything deeper, like www.mydomain.com/resource/123, breaks the value of the current directory ('.') while in index.html. For example, a script tag in my index.html like this

How do I return a HTTP 404 status code from a SPA?

你说的曾经没有我的故事 提交于 2019-11-28 23:41:19
I saw a few questions like this around (like this one ), but none of them tackle the problem specifically. So Google is now supporting SPAs and most web browsers do HTML5 pushState . My AngularJS (but could be any JS thing) website is using the URL to determine an API route. It then performs the API call and then renders the content accordingly. However, right now Google tagged this site as "being hacked" since EVERY URL returns an HTTP 200 status code (example.com/get-free-viagra included). Fair, but how do I return a 404? Or at least inform Google that this is a not-found page? They don't

Firebase hosting: How to prevent caching for the index.html of an SPA

微笑、不失礼 提交于 2019-11-28 21:25:15
I'm hosting an SPA on firebase where almost all paths get rewritten to index.html . I'm using webpack hash based cache busting, so I want to always prevent caching of my index.html but not any other files. I'm finding it surprisingly difficult to do so. Specifically, my file layout looks like this / ├── index.html ├── login.html ├── js │ ├── login.ba22ef2579d744b26c65.bundle.js │ └── main.6d0ef60e45ae7a11063c.bundle.js └── public └── favicon-16x16.ico I started naively with "sources": "index.html" before reading this quote from the docs. Each definition must have a source key that is matched

ASP.NET MVC and Angularjs together + ASP.NET Web API

左心房为你撑大大i 提交于 2019-11-28 20:51:40
I would like to know the advantages and disadvantages of using these 2 worlds: ASP.NET MVC and Angularjs together(without razor, Angularjs will do the job). AngularJS(front end) + ASP.NET Web API(back end). We are focusing on SPA/Mini-SPA for a medium/large Enterprise project with a lot of server side business rules and calculations. Im focusing on security too. The advantages and disadvantages opinions would help me to find the aswere for this question inside my head: Would it be a wise decision to use ASP.NET Web API(backend), ASP.NET MVC and Angularjs together? Rohan Büchner Yes, it would

How to integrate OAuth with a single page application?

爱⌒轻易说出口 提交于 2019-11-28 18:27:24
问题 When using OAuth (2) I need a redirection endpoint in my application that the OAuth-offering service can redirect to, once I have been authenticated. How do I handle this in a single page application? Of course, a redirect to the OAuth-offering service is not nice here, and it may not even be possible to redirect back. I know that OAuth also supports a username / password based token generation. This works perfectly with an AJAX call, but requires my single page application to ask for a

How to force update Single Page Application (SPA) pages?

孤街浪徒 提交于 2019-11-28 17:27:49
In fully server side based rendering (non Web 2.0), deploying server side code would directly update client side pages upon page reload. In contrast, in React based Single Page Application, even after React components were updated, there would be still some clients using old version of the components (they only get the new version upon browser reload, which should rarely happen) -> If the pages are fully SPA, it's possible that some clients only refresh the pages after a few hours. What techniques should be employed to make sure the old components versions are not used anymore by any clients?