|
1402 | 1402 | }]); |
1403 | 1403 | }); |
1404 | 1404 |
|
1405 | | - app.directive('smDropdown', ['SemanticUI', |
1406 | | - function SemanticDropdown(SemanticUI) |
| 1405 | + app.directive('smDropdown', ['SemanticUI', '$timeout', |
| 1406 | + function SemanticDropdown(SemanticUI, $timeout) |
1407 | 1407 | { |
1408 | 1408 | return { |
1409 | 1409 |
|
|
1508 | 1508 | }); |
1509 | 1509 | }; |
1510 | 1510 | }, |
1511 | | - link: function(scope, element, attributes) |
1512 | | - { |
1513 | | - var applyValue = function( value ) |
1514 | | - { |
1515 | | - if ( element.dropdown('is multiple') ) |
1516 | | - { |
1517 | | - if ( value instanceof Array ) |
1518 | | - { |
1519 | | - var translatedValue = []; |
1520 | | - |
1521 | | - for (var i = 0; i < value.length; i++) |
1522 | | - { |
1523 | | - var translated = scope.translateValue( value[ i ] ); |
1524 | | - |
1525 | | - if ( angular.isDefined( translated ) ) |
1526 | | - { |
1527 | | - translatedValue.push( translated ); |
| 1511 | + link: function (scope, element, attributes) { |
| 1512 | + var applyValue = function (value) { |
| 1513 | + $timeout(function () { |
| 1514 | + if (element.dropdown('is multiple')) { |
| 1515 | + if (value instanceof Array) { |
| 1516 | + var translatedValue = []; |
| 1517 | + |
| 1518 | + for (var i = 0; i < value.length; i++) { |
| 1519 | + var translated = scope.translateValue(value[ i ]); |
| 1520 | + |
| 1521 | + if (angular.isDefined(translated)) { |
| 1522 | + translatedValue.push(translated); |
| 1523 | + } |
1528 | 1524 | } |
1529 | | - } |
1530 | 1525 |
|
1531 | | - element.dropdown( 'set exactly', translatedValue ); |
| 1526 | + element.dropdown('set exactly', translatedValue); |
| 1527 | + } |
1532 | 1528 | } |
1533 | | - } |
1534 | | - else |
1535 | | - { |
1536 | | - element.dropdown( 'set selected', scope.translateValue( value ) ); |
1537 | | - } |
| 1529 | + else { |
| 1530 | + element.dropdown('set selected', scope.translateValue(value)); |
| 1531 | + } |
| 1532 | + }, 0); |
1538 | 1533 | }; |
1539 | 1534 |
|
1540 | 1535 | SemanticUI.setDefaultFunction( scope, 'label', attributes, function(locals){return locals.item} ); |
|
0 commit comments