single-page-application

Partial Entity Updates in WebAPI PUT/POST

无人久伴 提交于 2019-11-30 11:24:33
问题 Say you have a repository method to update a Document: public Document UpdateDocument(Document document) { Document serverDocument = _db.Documents.Find(document.Id); serverDocument.Title = document.Title; serverDocument.Content = document.Content; _db.SaveChanges(); return serverDocument; } In this case, the entity has two properties. When updating a Document, both of these properties are required in the JSON request, so a request to PUT /api/folder with a body of { "documentId" = "1", "title

ValidateAntiForgeryToken with SPA architecture

∥☆過路亽.° 提交于 2019-11-30 10:52:06
问题 I am trying to set Register and Login for Hot Towel SPA applicantion. I have created SimpleMembershipFilters and ValidateHttpAntiForgeryTokenAttribute based on the asp.net single page application template. How do you get the @Html.AntiForgeryToken() code to work in the Durandal SPA pattern. Currently I have a register.html <section> <h2 data-bind="text: title"></h2> <label>Firstname:</label><input data-bind="value: firstName" type="text" /> <label>Lastname:</label><input data-bind="value:

Search-by filter in Angular.js,

会有一股神秘感。 提交于 2019-11-30 09:03:16
I am new to this framework, hence practicing Angularjs and following the tutorials available on the website. there is an example were we can search the data present in table, the example is as follows, <!DOCTYPE html> <html ng-app="SmartPhoneApp"> <head> <title>Smart phone Angular</title> <script type="text/javascript" src="D:/Rahul Shivsharan/Installers/AngularJS/angular.js"></script> <script type="text/javascript"> var smartPhoneApp = angular.module("SmartPhoneApp",[]); smartPhoneApp.controller("phoneCtrl",function($scope){ $scope.phones = [ { "modelName" : "LUMIA 520", "companyName" :

Dealing with expired access tokens in OAuth2 implicit grant

人盡茶涼 提交于 2019-11-30 05:56:29
问题 The specification of OAuth2 states that an authorization server must not issue a refresh token when using implicit grant. In our use case we protect a RESTful API with OAuth2 and use a Single Page Javascript application as a client for this API. As it would be very difficult to redirect to the authorization server after an access token has expired, we are searching for a better way to get a new valid token. I could think about two different approaches and wonder which one could be better: Use

Refactoring and removing unused CSS from SASS/LESS files

最后都变了- 提交于 2019-11-30 05:17:37
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 these tasks? Thanks in advance ! For finding and remove unused CSS use Uncss which has implementation as

Pass Constant Values to Angular from _layout.cshtml

混江龙づ霸主 提交于 2019-11-30 04:54:04
问题 Okay, so I have a constant variables in the _Layout.cshtml of ASP.Net SPA project and I would to pass them so that Angular will have access to those. How can I do that? For example, here is one value I am trying to transfer. var lenderValues = @Html.Action("GetLenderDropdownValues", "Dropdown"); and here is how my first app.component boots up. <my-rite-ui>Loading...</my-rite-ui> I know how to do it in AngularJS 1.x with just constant and injecting that constant whereever is needed, but couldn

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

有些话、适合烂在心里 提交于 2019-11-30 04:11:13
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 is before or after the # character. On the other hand, twitter shows a real HTTP 404 for any invalid

What is client side MVC and how is it implemented in JavaScript?

主宰稳场 提交于 2019-11-30 02:54:47
问题 Recently gone through many articles explaining single page application. But i am very much confused about the architecture or rather how it works. There is some thing new called client side MVC implemented by using javascript. Till now i had seen server side MVC architecture. What is this client side MVC? Where does the client side MVC files are hosted. Is it hosted along with server files similar to typical web application. What is the role of server side java script like node.js. What is

How to handle / ignore a bad route with durandal?

孤人 提交于 2019-11-29 23:19:24
问题 I'm trying to conditionally block a route from being accessed. I think this can be done with guardRoute: http://durandaljs.com/documentation/Router/ function guardRoute(routeInfo, params, instance) : object - Before any route is activated, the guardRoute function is called. You can plug into this function to add custom logic to allow, deny or redirect based on the requested route. To allow, return true. To deny, return false. To redirect, return a string with the hash or url. You may also

Partial Entity Updates in WebAPI PUT/POST

♀尐吖头ヾ 提交于 2019-11-29 23:12:40
Say you have a repository method to update a Document: public Document UpdateDocument(Document document) { Document serverDocument = _db.Documents.Find(document.Id); serverDocument.Title = document.Title; serverDocument.Content = document.Content; _db.SaveChanges(); return serverDocument; } In this case, the entity has two properties. When updating a Document, both of these properties are required in the JSON request, so a request to PUT /api/folder with a body of { "documentId" = "1", "title" = "Updated Title" } would return an error because "content" was not provided. The reason I'm doing