Skip to content

Commit

Permalink
just bind to click, other events weren't doing anything
Browse files Browse the repository at this point in the history
  • Loading branch information
jseppi committed Oct 28, 2014
1 parent c09121b commit c5c1bf6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
16 changes: 6 additions & 10 deletions angular-dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ dd.run(['$templateCache', function ($templateCache) {

}]);

dd.directive('dropdownSelect', ['DropdownService', '$window',
function (DropdownService, $window) {
dd.directive('dropdownSelect', ['DropdownService',
function (DropdownService) {
return {
restrict: 'A',
replace: true,
Expand All @@ -79,9 +79,7 @@ dd.directive('dropdownSelect', ['DropdownService', '$window',
});
};

// Does not register touchstart events outside of directive scope
var $clickEvent = ('click'||'touchstart' in $window);
$element.bind($clickEvent, function (event) {
$element.bind('click', function (event) {
event.stopPropagation();
DropdownService.toggleActive($element);
});
Expand Down Expand Up @@ -119,8 +117,8 @@ dd.directive('dropdownSelectItem', [
}
]);

dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window', '$templateCache',
function ($parse, $compile, DropdownService, $window, $templateCache) {
dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$templateCache',
function ($parse, $compile, DropdownService, $templateCache) {
return {
restrict: 'A',
replace: false,
Expand All @@ -133,8 +131,6 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
$scope.labelField = $attrs.dropdownItemLabel || 'text';

// Does not register touchstart events outside of directive scope.
var $clickEvent = ('click'||'touchstart' in $window);
var $template = angular.element($templateCache.get('ngDropdowns/templates/dropdownMenu.html'));
// Attach this controller to the element's data
$template.data('$dropdownMenuController', this);
Expand All @@ -157,7 +153,7 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
});
};

$element.bind($clickEvent, function (event) {
$element.bind('click', function (event) {
event.stopPropagation();
DropdownService.toggleActive(tpl);
});
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-dropdowns",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/jseppi/angular-dropdowns",
"authors": [
"James Seppi <[email protected]> (http://github.com/jseppi)",
Expand Down
16 changes: 6 additions & 10 deletions dist/angular-dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ dd.run(['$templateCache', function ($templateCache) {

}]);

dd.directive('dropdownSelect', ['DropdownService', '$window',
function (DropdownService, $window) {
dd.directive('dropdownSelect', ['DropdownService',
function (DropdownService) {
return {
restrict: 'A',
replace: true,
Expand All @@ -79,9 +79,7 @@ dd.directive('dropdownSelect', ['DropdownService', '$window',
});
};

// Does not register touchstart events outside of directive scope
var $clickEvent = ('click'||'touchstart' in $window);
$element.bind($clickEvent, function (event) {
$element.bind('click', function (event) {
event.stopPropagation();
DropdownService.toggleActive($element);
});
Expand Down Expand Up @@ -119,8 +117,8 @@ dd.directive('dropdownSelectItem', [
}
]);

dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window', '$templateCache',
function ($parse, $compile, DropdownService, $window, $templateCache) {
dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$templateCache',
function ($parse, $compile, DropdownService, $templateCache) {
return {
restrict: 'A',
replace: false,
Expand All @@ -133,8 +131,6 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
$scope.labelField = $attrs.dropdownItemLabel || 'text';

// Does not register touchstart events outside of directive scope.
var $clickEvent = ('click'||'touchstart' in $window);
var $template = angular.element($templateCache.get('ngDropdowns/templates/dropdownMenu.html'));
// Attach this controller to the element's data
$template.data('$dropdownMenuController', this);
Expand All @@ -157,7 +153,7 @@ dd.directive('dropdownMenu', ['$parse', '$compile', 'DropdownService', '$window'
});
};

$element.bind($clickEvent, function (event) {
$element.bind('click', function (event) {
event.stopPropagation();
DropdownService.toggleActive(tpl);
});
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-dropdowns.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c5c1bf6

Please sign in to comment.