Semantic-Org / Semantic-UI-Angular

Semantic UI Angular Integrations
MIT License
557 stars 117 forks source link

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

Closed ismorodin closed 8 years ago

ismorodin commented 8 years ago

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();
        }
    };
})
matheuspoleza commented 8 years ago

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.

ismorodin commented 8 years ago

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

matheuspoleza commented 8 years ago

our directives: https://github.com/Semantic-Org/Semantic-UI-Angular/tree/master/src/components

angular element docs: https://docs.angularjs.org/api/ng/function/angular.element