Skip to content

Commit 8cf4135

Browse files
author
scates
committed
Fixed dropdown to actually update the ng-model on selection... was staying with the default
1 parent beb6fc7 commit 8cf4135

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dropdown/dropdown.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ angular.module('angularify.semantic.dropdown', ['ngSanitize'])
2222
};
2323

2424
this.update_title = function(title) {
25-
console.log(title);
2625
var i = 0;
2726
for (i in $scope.items) {
2827
$scope.items[i].title = title;
@@ -73,20 +72,23 @@ angular.module('angularify.semantic.dropdown', ['ngSanitize'])
7372
//
7473
scope.$watch('model', function(val) {
7574
// update title
75+
scope.model = val;
7676
DropDownController.update_title(val);
7777
});
7878

7979
//
8080
// Click handler
8181
//
8282
element.bind('click', function() {
83+
8384
if (scope.open === false) {
8485
scope.open = true;
8586
scope.$apply(function() {
8687
scope.dropdown_class = 'ui selection dropdown active visible';
8788
});
8889
} else {
8990
scope.open = false;
91+
scope.model = scope.title
9092
scope.$apply(function() {
9193
scope.dropdown_class = 'ui selection dropdown';
9294
});
@@ -121,6 +123,7 @@ angular.module('angularify.semantic.dropdown', ['ngSanitize'])
121123
// Menu item click handler
122124
//
123125
element.bind('click', function() {
126+
124127
DropDownController.update_title(scope.title);
125128
});
126129
}

0 commit comments

Comments
 (0)