Semantic-Org/Semantic-UI-Angular

Dropdown list can't be chosen the option marked with attribute 'selected'!

ismorodin opened this issue · 3 comments

Dropdown list can't be selected the option marked with attribute 'selected' on the SemanticUI Framework with AngularJS. By default remains placeholder.

.directive('mydropdown', function () {
    return {
        restrict: 'AE',
        replace: true,
        scope: {
            "items": "=",
            "model": "=",
            "inputModel": "@",
            "inputName": "@"
        },
        template: '<select class="ui dropdown" name="{{ inputName }}" ng-model="model[inputName]"><option ng-repeat="item in items" value="{{item.id}}" ng-selected="model[inputName]==item.id" ng-bind="item.title"></option></select>',
        link: function (scope, element, attrs) {
            $(element).dropdown();
        }
    };
})

hi, @ismorodin. This project is not about this. They are components that use semanticui elements and we dont have all. Your problem can be solved with an issue in https://github.com/Semantic-Org/Semantic-UI .

But, your problem maybe is this:
$(element).dropdown();

The angular element element is layer to control the DOM as a jQuery. Check out how we make our SemanticUI directives in this project, maybe help you. I will close this issue, but if you want ping me on gitter, ok? I will help you.

Ok, Where can i see examples with AngularJS directive at your project?