mapping
7 years ago
angular-chosen.directive.js
7 years ago
attributes.service.js
7 years ago
autodetect.directive.js
7 years ago
cascade.directive.js
7 years ago
contenteditable.directive.js
7 years ago
currency.service.js
7 years ago
droppable.directive.js
7 years ago
export.service.js
7 years ago
focusMeWhenEnabled.directive.js
7 years ago
googleCategoriesService.js
7 years ago
main.controller.js
7 years ago
styledInput.directive.js
7 years ago
template.service.js
7 years ago
tipsy.directive.js
7 years ago
wpHttp.service.js
7 years ago
cascade.directive.js
35 lines
| 1 | GoogleMerchants.directive('cascade', [function() { |
| 2 | return { |
| 3 | restrict: 'A', |
| 4 | controller: ['$scope', function($scope) { |
| 5 | |
| 6 | var uniqueId = function() { |
| 7 | return 'id-' + Math.random().toString(36).substr(2, 16); |
| 8 | }; |
| 9 | |
| 10 | $scope.$on('wpae.gender.changed', function(event, scopeId, selectedGender){ |
| 11 | if($scope.$id != scopeId) { |
| 12 | $scope.node.selectedGender = selectedGender; |
| 13 | } |
| 14 | }); |
| 15 | |
| 16 | $scope.$on('wpae.ageGroup.changed', function(event, scopeId, selectedAgeGroup){ |
| 17 | if($scope.$id != scopeId) { |
| 18 | $scope.node.selectedAgeGroup = selectedAgeGroup; |
| 19 | } |
| 20 | }); |
| 21 | |
| 22 | $scope.selectGender = function() { |
| 23 | $scope.$parent.$broadcast('wpae.gender.changed', $scope.$id, $scope.node.selectedGender); |
| 24 | }; |
| 25 | |
| 26 | $scope.selectAgeGroup = function() { |
| 27 | $scope.$parent.$broadcast('wpae.ageGroup.changed', $scope.$id, $scope.node.selectedAgeGroup); |
| 28 | }; |
| 29 | |
| 30 | }], |
| 31 | link: function (scope, element, attributes) { |
| 32 | scope.cascadeName = attributes.$attr.cascade; |
| 33 | } |
| 34 | }; |
| 35 | }]); |