Last active
August 29, 2015 14:16
-
-
Save AllenFang/bf100673334ff6947836 to your computer and use it in GitHub Desktop.
It's my blogger article for http://programer-learn.blogspot.com/2015/03/angularjs-bootstrap-dropdown-directive.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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