Skip to content

Instantly share code, notes, and snippets.

@A2H111
Created August 13, 2016 13:39
Show Gist options
  • Save A2H111/4d6a0c4bd3147c3030270bcf67fb0ebb to your computer and use it in GitHub Desktop.
Save A2H111/4d6a0c4bd3147c3030270bcf67fb0ebb to your computer and use it in GitHub Desktop.
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type="text/javascript">
angular.module('drpdwnApp', []).controller('drpdwnCtrl', function ($scope, $http) {
$scope.ProductList = null;
$scope.CustomerList = null;
//Declaring the function to load data from database
$scope.fillProductList = function () {
$http({
method: 'POST',
url: 'AngularCascadingDropDownList.aspx/GetProductList',
data: {}
}).success(function (result) {
$scope.ProductList = result.d;
});
};
//Call the functino to populate the second dropdownlist
//Here we pass the selected value from first dropdownlist as input parameter
$scope.fillCustomerList = function (idvalue) {
$http({
method: 'POST',
url: 'AngularCascadingDropDownList.aspx/GetCustomerList',
data: JSON.stringify({ orderID: idvalue })
}).success(function (result) {
$scope.CustomerList = result.d;
});
};
//Calling the function to load the data on pageload
$scope.fillProductList();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment