single-page-application

In a single-page app, what is the right way to deal with wrong URLs (404 errors)?

僤鯓⒐⒋嵵緔 提交于 2019-12-18 11:38:45
问题 I am currently writing a web application using angularjs, but I think this question applies to any client-side javascript framework that does routing on the client side (as angular does). In a single-page app, what is the right way to deal with wrong URLs? Looking at a few major sites, I see that gmail will redirect to the inbox if you type any random URL below https://mail.google.com/mail/. This happens server-side (with an http 300 code) or client-side, depending on whether the wrong path

Call function on directive parent scope with directive scope argument

杀马特。学长 韩版系。学妹 提交于 2019-12-18 10:40:49
问题 I am developing a directive which shows and hides it's contents based on a click event (ng-click) defined in it's template. On some views where the directive is used I'd like to be able to know if the directive is currently showing or hiding it's contents so I can respond to the DOM changes. The directive has isolated scope and I am trying to notify the parent scope when the directive has been "toggled". I'm attempting to accomplish this by passing a callback function to the directive where

Using vue.js with semantic UI

╄→尐↘猪︶ㄣ 提交于 2019-12-18 10:09:25
问题 I'm trying to use webpack + Semantic UI with Vue.js and I found this library https://vueui.github.io/ But there was problem compling: ERROR in ./~/vue-ui/components/sidebar/sidebar.jade Module parse failed: /Project/node_modules/vue- ui/components/sidebar/sidebar.jade Unexpected token (1:24) You may need an appropriate loader to handle this file type. So I installed jade(pug) but still no luck. And there's comment in github for that lib: WIP, do not use ( https://github.com/vueui/vue-ui ) I

Apply loading spinner during ui-router resolve

谁说我不能喝 提交于 2019-12-18 09:54:48
问题 resolve property of $routeProvider allows to execute some jobs BEFORE corresponding view is rendered. What if I want to display a spinner while those jobs are executed in order to increase user experience? Indeed, otherwise the user would feel the application has been blocked since no view elements were displayed for some milliseconds > 600 for instance. Of course, there was the way to define a global div element out of the current view to display in order to display the spinner thanks to the

Angularjs add controller dynamically

こ雲淡風輕ζ 提交于 2019-12-18 09:19:26
问题 It looks like this questions already asked few times but there is no correct answer to it. my case: i'm loading a template (with html and script) init to div using ajax (not using angular routing temple for some reason). index.html (main) <!DOCTYPE html> <html ng-app="app" ng-controller="AppCtrl"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Web</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular

AngularJS routing not working after site hosted into IIS

我与影子孤独终老i 提交于 2019-12-18 05:07:16
问题 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

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

情到浓时终转凉″ 提交于 2019-12-18 02:38:10
问题 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).

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 22:53:18
问题 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

Angular-ui.router: Update URL without view refresh

点点圈 提交于 2019-12-17 22:46:06
问题 I have an Angular SPA that presents a variety of recommendation lists, and a Google Map of locations, based on different cuts of some restaurant data (see m.amsterdamfoodie.nl). I want each of these lists to have their own URL. In order for Google to crawl the different lists I use <a> tags for the offcanvas navigation. At present the <a> tag causes a view refresh, which is very noticeable with the map. I can prevent this using ng-click and $event.preventDefault() (see code snippets below),

what is the purpose of use abstract state?

流过昼夜 提交于 2019-12-17 20:16:26
问题 I am working on my tutorial AngularUI project. I read all about states, nested states and abstract states. The problem is that I can't understand why and when I should use abstract state? 回答1: Abstract state does mean the state that you wrote can't be accessible directly. Abstract states still need their own for their children to plug into. It gets called when we load its child's state. You can use abstract state to define some initial pattern of your page, suppose you can take an example of