Having trouble with my datepicker input values not being passed as parameters in Angular and eventually to a C# parameter. Need help with setting up datepicker input and passing the values correctly.
<div layout="column">
<md-content md-primary>
<md-toolbar layout="flex>
<button ng-click="toggleSidenav('left')" class="menuBtn">
<span class="visually-hidden">Menu</span>
</button>
<h1>selling Order History</h1>
</md-toolbar>
<div layout="row" style="height:100%" flex>
<md-sidenav layout="column" ng-class="lockedOpen" class="md-closed md-sidenav-left md-whiteframe-z2" md-component-id="left>
<div>
</div>
</md-sidenav>
<md-content ng-controller="sellingListCtrl" layout="column" flex class="md-padding>
<md-tabs class="md-primary clearfix" md-selected="0" flex>
<md-tab label="selling Orders">
<input type="date" ng-model="filter.fromDate" />
<input type="date" ng-model="filter.toDate" />
...
Check out the accompanying .js file:
var sellingApp = angular.module('sellingApp', ['ngMaterial', 'ui.router', 'angularMoment', 'breeze.directives', 'breeze.angular', 'ui.bootstrap.pagination']).run(['breeze', function (breeze) { }]);;
sellingApp.controller('sellingListCtrl', [
'$scope', '$filter', '$location', 'breeze','sellingService',
function ($scope, $filter, $location, breeze, sellingService) {
$scope.pageLoaded = true;
$scope.lists = [];
$scope.loadselling = function () {
$scope.pageLoaded = false;
$scope.filter = {};
//$scope.filter.fromDate = "1/1/2015";
//$scope.filter.toDate = "1/1/2015";
sellingService.salesstatus($scope.filter).then(function (data) {
$scope.lists = data;
$scope.totalItems = data.totalItems;
if (data!=null) {
$scope.pageLoaded = true;
}
});
}
//$scope.init();
}
]);
sellingApp.factory('sellingService', ['$filter','$http', function ($filter, $http) {
function salesstatus(filter) {
var f = filter;
console.log(breeze);
return $http({
method: 'GET',
url: '/Services/SalesStatus',
params: { fromDate: f.fromDate, toDate: f.toDate, sParts: true }
}).then(function (result)
{ return result.data; })
//.catch(function (s) { console.log(s); });
}
return {
salesstatus: salesstatus
};
}]);