Skip to content

Commit 18f0ff4

Browse files
committed
bump
1 parent f654a01 commit 18f0ff4

File tree

5 files changed

+40
-23
lines changed

5 files changed

+40
-23
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
2+
## 2014-08-03
3+
- added track by (by João Neto <joaopintoneto@gmail.com>)
4+
5+
## 2014-08-02
6+
- fixed ng-required ref #9 (by João Neto <joaopintoneto@gmail.com>)
7+
8+
## 2014-06-23
9+
- Fixing script path (by Danilo Valente <danilovalente96@gmail.com>)
10+
- Fixing script path (by Danilo Valente <danilovalente96@gmail.com>)
11+
212
## 2014-06-21
13+
- updated .travis.yml (by João Neto <joaopintoneto@gmail.com>)
14+
- updated .travis.yml (by João Neto <joaopintoneto@gmail.com>)
15+
- updated .travis.yml (by João Neto <joaopintoneto@gmail.com>)
16+
- renamed travis config file (by João Neto <joaopintoneto@gmail.com>)
17+
- updated CHANGELOG.md (by João Neto <joaopintoneto@gmail.com>)
318
- build (by João Neto <joaopintoneto@gmail.com>)
419
- added CHANGELOG.md to bower.json ignore (by João Neto <joaopintoneto@gmail.com>)
520
- added capability to handle ng-options added capability to configure bootstrap select options fix tests (by João Neto <joaopintoneto@gmail.com>)

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-select",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"main": "./build/angular-bootstrap-select.js",
55
"description": "Directive to wrap bootstrap-select",
66
"author": "https://github.com/joaoneto/angular-bootstrap-select/graphs/contributors",

build/angular-bootstrap-select.js

+22-20
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,54 @@ angular.module('angular-bootstrap-select.extra', [])
44
return {
55
restrict: 'A',
66
link: function (scope, element, attrs) {
7-
//prevent directive from attaching itself to everything that defines a toggle attribute
7+
// prevent directive from attaching itself to everything that defines a toggle attribute
88
if (!element.hasClass('selectpicker')) {
99
return;
1010
}
1111

1212
var target = element.parent();
13+
var toggleFn = function () {
14+
target.toggleClass('open');
15+
};
16+
var hideFn = function () {
17+
target.removeClass('open');
18+
};
1319

14-
element.bind('click', function () {
15-
target.toggleClass('open')
16-
});
20+
element.on('click', toggleFn);
21+
element.next().on('click', hideFn);
1722

18-
element.next().find('li').bind('click', function () {
19-
target.toggleClass('open')
20-
})
23+
scope.$on('$destroy', function () {
24+
element.off('click', toggleFn);
25+
element.next().off('click', hideFn);
26+
});
2127
}
2228
};
2329
});
2430

2531
angular.module('angular-bootstrap-select', [])
26-
.directive('selectpicker', ['$timeout', '$parse', function ($timeout, $parse) {
32+
.directive('selectpicker', ['$parse', function ($parse) {
2733
return {
2834
restrict: 'A',
2935
require: '?ngModel',
30-
priority: 1001,
36+
priority: 10,
3137
compile: function (tElement, tAttrs, transclude) {
3238
tElement.selectpicker($parse(tAttrs.selectpicker)());
39+
tElement.selectpicker('refresh');
3340
return function (scope, element, attrs, ngModel) {
34-
if (angular.isUndefined(ngModel)){
35-
return;
36-
}
41+
if (!ngModel) return;
3742

38-
scope.$watch(attrs.ngModel, function () {
39-
$timeout(function () {
40-
element.selectpicker('val', element.val());
43+
scope.$watch(attrs.ngModel, function (newVal, oldVal) {
44+
scope.$evalAsync(function () {
45+
if (!attrs.ngOptions || /track by/.test(attrs.ngOptions)) element.val(newVal);
4146
element.selectpicker('refresh');
4247
});
4348
});
4449

4550
ngModel.$render = function () {
46-
$timeout(function () {
47-
element.selectpicker('val', ngModel.$viewValue || '');
51+
scope.$evalAsync(function () {
4852
element.selectpicker('refresh');
4953
});
50-
};
51-
52-
ngModel.$viewValue = element.val();
54+
}
5355
};
5456
}
5557

build/angular-bootstrap-select.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-select",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Directive to wrap bootstrap-select",
55
"devDependencies": {
66
"grunt-karma": "~0.4.5",

0 commit comments

Comments
 (0)