Search Posts

Category: model-view-controller

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=””></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: […]

MVC AngularJS date field unable to edit

My HTML for date field is <input class=”form-control”type=”text” name=”txtOrderContractFinishDate” id=”txtOrderContractFinishDate” ng-model=”SelectedOrder.OrderContractFinishDate | jsDate | date:’MM/dd/yyyy'” placeholder=”mm/dd/yyyy” /> jsDate function is as below app.filter(“jsDate”, function () { return function (x) { return new Date(parseInt(x.substr(6))); }; }); the date gets converted from JSON date format to MMddyyy format without any problem. But once after data is displayed if I try to edit the date field it is not allowing me to do so. I am new to […]

I want to move focus left right up down in html table

this is C# loops which create html table string from controller for (int j=0; j< ds.Tables[“tblMaster”].Rows.Count;j++) { html += ” <tr>”; //cell for customer name html += “<td class=’bg-primary’ onclick=CashMemo(‘”+ fromDate +”‘,'”+ ToDate +”‘,”+ ds.Tables[“tblMaster”].Rows[j][“intPoductId”].ToString() +”,”+ ds.Tables[“tblMaster”].Rows[j][“intCustomerId”].ToString() + “)>” + ds.Tables[“tblMaster”].Rows[j][“varName”].ToString()+”</td>”; if (ds.Tables[“tblMaster1”] != null) { ds.Tables[“tblMaster1”].Clear(); } string query1 = “”; //product id //custemr id query1 = ” spLoadMonthlyDaysName ‘” + fromDate + “‘,'” + ToDate + “‘ ,” + ds.Tables[“tblMaster”].Rows[j][“intPoductId”].ToString() + “,” + […]

Pass token in header for authentication in MVC and Web API

Integrating MVC app with Web API, Azure Users Authentication is done using OWIN, Want to remove authentication cookie and pass token in header for api call. how to do it? I use MSAL.cs file for Azure AD authentication. Want to pass token in api call header. first load MVC application page, after authentication call web api methods. I used following code for azure AD autherization, private async Task OnAuthorizationCodeReceived(AuthorizationCodeReceivedNotification notification) { // Extract the code […]

no execute function in controller

I have the following code, in which when running it never enters the function, any ideas? (function (app) { ‘use strict’; app.controller(‘indexCtrl’, indexCtrl); indexCtrl.$inject = [‘$scope’, ‘apiService’, ‘notificationService’]; function indexCtrl($scope, apiService, notificationService) { $scope.pageClass = ‘page-home’; $scope.test = ‘Lo logre’; } })(angular.module(‘austral’)); Source: AngularJS

Angular template loading without data?

Having a really weird issue where my template loads without any data in it, but when I refresh the page enough times, the data eventually does load. I am not sure what is going on or how to fix this. I’ll add some code below. Let me know if you need other pieces. Server: app.get(‘/api/listings/:listingId’, auth.ensureAuthenticated,; Controller: function show(req, res) { db.Listing.findById(req.params.listingId, function(err, foundListing) { if(err) { console.log(‘ error’, err); } res.json(foundListing); }); } […]

Change made to $scope variable through event captured by $rootScope doesn’t update in view

I have a somewhat old ionic App (ionic v 1.3.x). Based on certain asynchronous changes detected in another part of the App it emits $rootScope level events. I catch that event in a Controller to update the view when that event is caught. Something along the lines below. // In a different part of the App an asynchronous event is caught $rootScope.$emit(“some:change:event”, grpKey); // from asynchronous event // In Controller $rootScope.$on(“some:change:event”, function(event, param){ reComputeValues(param); } […]