Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Last active August 29, 2015 14:16
Show Gist options
  • Save AllenFang/bf100673334ff6947836 to your computer and use it in GitHub Desktop.
Save AllenFang/bf100673334ff6947836 to your computer and use it in GitHub Desktop.
angular.module("demoApp", ['ng.bs.dropdown'])
.controller("YearController", function($scope){
$scope.years = [
"2015",
"2014",
"2013",
"2012",
"2011",
"2010"
];
$scope.selectYear = $scope.years[2]; //current select item
/*changeYear function will be called if dropdown change*/
$scope.changeYear = function(){
console.log("YearController say... " + $scope.selectYear);
}
});
angular.module("demoApp", ['ng.bs.dropdown'])
.controller("DividerController", function($scope){
$scope.actions = [
"Action",
"Another action",
"Something else here",
"separated link1",
"Action anain",
"Nothing else",
"separated link2"
];
$scope.selectAction = null;
});
<script src="dist/bsDropdown.min.js"></script>
//.......
<div ng-controller="YearController">
<h4>You select {{selectYear}} ....</h4><br/>
<div bs-dropdown
bs-dropdown-display="MyDropDown"
bs-dropdown-items="years"
ng-model="selectYear"
ng-change="changeYear()"></div>
</div>
<script src="dist/bsDropdown.min.js"></script>
//.......
<div ng-controller="DividerController">
<div bs-dropdown
bs-dropdown-display="MyDropDown"
bs-dropdown-items="actions"
bs-dropdown-divider="{{[2,5]}}"
ng-model="selectAction"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment