Controller Code
</pre><pre name= "Code" class= "JavaScript" >function Billsdetailcontroller ($scope, $http, $log) {var self = This $scope. Billsdetaildata = []; $scope. Billsdetailtotaldata = []; $scope. Model = [{id:201401, ProductName: ' 2014-01 '}, {id:201402, productName: ' 2014-02 '}, {id:201403, productName: ' 2014-03 '}, {id:201404, productName: ' 2014-04 '}, {id:201405, ProductName: ' 2014-05 '}, {id:201406, productName: ' 2014-06 '}, { id:201407, ProductName: ' 2014-07 '}, {id:201408, productName: ' 2014-08 '}, {id:201 409, ProductName: ' 2014-09 '}, {id:201410, productName: ' 2014-10 '}, {id:201411, ProductName: ' 2014-11 '}, {id:201412, productName: ' 2014-12 '}]; $scope. CurrentPeriod = $scope. Model[0].productname; $scope. Change = function () {SELf.getdetailpageddataasync ($scope. CurrentPeriod); Self.getdetailtotaldata ($scope. CurrentPeriod); }
HTML code
<pre name= "code" class= "HTML" > <select id= "Selecterror" ng-model= "CurrentPeriod" ng-change= "Change ()" Ng-options= "Option.productname as option.productname for option in Model" > </select>
AngularJS: Use Ng-option to generate a drop-down box and invoke the controller