Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions dist/angular-semantic-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ angular.module('angularify.semantic.dimmer', [])
//
scope.$watch('model', function(val){
if (val == false || val == undefined)
return;
scope.dimmer_class = 'ui page dimmer';
else
scope.dimmer_class = 'ui page active dimmer';
});
Expand Down Expand Up @@ -265,6 +265,10 @@ angular.module('angularify.semantic.dropdown', [])
}
};

this.is_active = function(value) {
return $scope.model === value;
}

}
])

Expand Down Expand Up @@ -339,7 +343,7 @@ angular.module('angularify.semantic.dropdown', [])
title: '=title',
value: '=value'
},
template: '<div class="item" ng-transclude>{{ item_title }}</div>',
template: '<div class="item" ng-class="active_class()" ng-transclude>{{ item_title }}</div>',
link: function(scope, element, attrs, DropDownController) {

// Check if title= was set... if not take the contents of the dropdown-group tag
Expand All @@ -355,6 +359,12 @@ angular.module('angularify.semantic.dropdown', [])
scope.item_value = scope.value;
}

scope.active_class = function(value) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anyone please review this? Is creating a scope function in the linking process ok since this doesn't have a controller of its own?

if (DropDownController.is_active(scope.item_value)) {
return "selected active";
}
}

// Keep this option
DropDownController.add_option(scope.item_title, scope.item_value);

Expand Down Expand Up @@ -394,6 +404,10 @@ angular.module('angularify.semantic.modal', [])
}, function (modelValue){
element.modal(modelValue ? 'show' : 'hide');
});
scope.$on('$destroy', function() {
element.modal('hide');
element.remove();
});
}
}
});
Expand Down
Loading