Search Posts

Category: c#

How to set checked property of checkboxes based on value from database using angular js

I have a group of checkboxes which are populated dynamically from database using AngularJs. Now, on edit I want to check the checkboxes whose value is stored in database. Below is the sample code: <div class=”row” > <div class=”col-sm-2″> <label>Select Metal :</label><label style=”color:red”>*&nbsp;</label> </div> <div class=”col-sm-8″> <div ng-repeat=”names in MetalTypes” class=”checkbox-inline” id=”MetalDiv” style=”font-size: larger; margin-left: 20px !important; margin-top: -10px !important;”> <div style=”margin:10px 10px 10px; margin-left:-16px;”> <input type=”checkbox” value=”{{names.Id}}” ng-model=”names.SELECTED” ng-checked=”object[names.Id]” ng-true-value=”‘Y'” ng-false-value=”‘N'” style=”margin-top:2px;” ng-change=”getSelectedMetal()” />{{names.Name}} […]

AngularJs post to .NET Controller always null

I’m trying to post data from an Angular controller to a .NET end point. The angular function looks like this: vm.save = function () { $http({ url: ‘Home/Save’, method: ‘POST’, data: vm.colours, contentType: “application/json; charset=utf-8”, header: {‘Content-type’: ‘application/json’} }) .success(function (response) { alert(response) } ) }; And the end point looks like this: [System.Web.Mvc.HttpPost] public void Save([FromBody]Colours input) { var temp = input; } The data posted to the end point is: Post header from […]

How to handle Oauth 2 access tokens from external provider?

I would like to use the token provided by another application in my Web Api (core 2.0) but think I’m missing something. Despite the wealth of info, nothing seems to match what I need it to do but perhaps I’m looking at it the wrong way. I currently have an angular 4 client fetching data from the api without any security and that works fine. As part of the requirements, I need to to make […]

Working with 2 Authentication Schemes with cross domain IDP

I’m trying to use cross domain authentication in my Angular/.net Core 2.0 app using OpenId hybrid flow. I’m using already developed IDP (identity provider) to login the user which uses the cookies authentication and response_type =’code id_token’ (for time being has to implement it using the hybrid flow later on Idp will support the implicit flow). In my angular .net core project, I configured it to use the idp server. public void ConfigureServices(IServiceCollection services) { […]

returning null in ASP.Net api from angular4

I literally spent all day to try to find out the solution and none of existing solutions to similar problems, seem to work on my problem even though the problem seems to be the quite similar…. I am doing a POST from angular4 to .net server but the server returns null. server [HttpPost] public string callBcknd([FromBody]string body) { try { Log.Info(string.Format(“{0}”, body)); } catch(Exception ex) { return “error”; } } } angular *note that I […]

Server to server Http request: client promise hangs page

Overview My web application homepage launch some request to my company server which perform a server to server request to retrieve some data from a customer communication bus, but it’s not possible to change page or refresh it until these request are not completed (or closed by timeout). What I’ve tried Following this stackoverflow example and trying to manually reject all the pending ajax request: Everything is rejected except the server to server request which […]

To use keyboard shortcut in list in angularjs

<html> <body> <div ng-app=”mvcapp” ng-controller=”AngularController”> <input ng-keyup=”obj.showList = true;” type=”text” class=”myInput form-control” name=”txtStorename” id=”txtStorename” placeholder=”Search for Store..” title=”Type in a Store” data-error-message=”Please enter StoreName” ng-model=”sname”> <ul ng-if=”obj.showList” id=”myUL” ng-repeat=”StoreList in Store| filter:{StoreName:sname}”> <li ng-click=”SelectedValue(StoreList.StoreName)” ng-cloak>{{StoreList.StoreName}}</li> </ul> <div ng-show=”(Store|filter:sname).length==0″ style=”color:red;font-weight:bold” ng-cloak>No Result Found</div> </div> <script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js”></script> <script> var angular = angular.module(‘mvcapp’, []); angular.controller(‘AngularController’, function ($scope, $http) { $scope.obj = {}; $scope.obj.showList = false; Getallitem() function Getallitem() { $http.get(‘/Coupons/GetStore’).success(function (data) { $scope.Store = data; }); } $scope.SelectedValue […]

On key up event list show up in angular js

<body> <div ng-app=”mvcapp” ng-controller=”AngularController”> <input type=”text” class=”myInput form-control” name=”txtStorename” id=”txtStorename” placeholder=”Search for Store..” title=”Type in a Store” data-error-message=”Please enter StoreName” ng-model=”sname” > <ul id=”myUL” ng-repeat=”StoreList in Store| filter:{StoreName:sname}”> <li ng-click=”SelectedValue(StoreList.StoreName)”>{{StoreList.StoreName}}</li> </ul> <div ng-show=”(Store|filter:sname).length==0″ style=”color:red;font-weight:bold”>No Result Found</div> </div> <script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js”></script> <script> var angular = angular.module(‘mvcapp’, []); angular.controller(‘AngularController’, function ($scope, $http) { Getallitem() function Getallitem() { $http.get(‘/Coupons/GetStore’).success(function (data) { $scope.Store = data; }); } $scope.SelectedValue = function (item) { document.getElementById(“txtStorename”).value = item; } }); </script> </body> Source: […]

visual studio project on windows is not working properly in visual studio for mac

in windows visual studio community 2015 my asp.net mvc is working but the same project in visual studio for mac is not working. for the word working i mean to say the http request that we make in angular.js to call a specific c# controller return an error of 500 why is that so? Please refer to a document if any Thanks in advance. Source: AngularJS

Next Page »