@@ -416,7 +416,7 @@ uis.controller('uiSelectCtrl',
416
416
$scope . $uisSource = Object . keys ( originalSource ( $scope ) ) . map ( function ( v ) {
417
417
var result = { } ;
418
418
result [ ctrl . parserResult . keyName ] = v ;
419
- result . value = $scope [ ctrl . parserResult . sourceName ] [ v ] ;
419
+ result . value = $scope . peopleObj [ v ] ;
420
420
return result ;
421
421
} ) ;
422
422
} ;
@@ -430,7 +430,6 @@ uis.controller('uiSelectCtrl',
430
430
}
431
431
432
432
ctrl . refreshItems = function ( data ) {
433
- $scope . calculateDropdownPos ( ) ;
434
433
data = data || ctrl . parserResult . source ( $scope ) ;
435
434
var selectedItems = ctrl . selected ;
436
435
//TODO should implement for single mode removeSelected
@@ -1911,8 +1910,22 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
1911
1910
self . parse = function ( expression ) {
1912
1911
1913
1912
1914
- //0000000000000000000000000000000000011111111100000000000000022222222222222003333333333333333333333000044444444444444444400000000000000005555500000666666666666600000000000000000000007777777770000000
1915
- var match = expression . match ( / ^ \s * (?: ( [ \s \S ] + ?) \s + a s \s + ) ? (?: ( [ \$ \w ] [ \$ \w ] * ) | (?: \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) ) ) \s + i n \s + ( [ \w ] + ) \s * ( | \s * [ \s \S ] + ?) ? (?: \s + t r a c k \s + b y \s + ( [ \s \S ] + ?) ) ? \s * $ / ) ;
1913
+ var match ;
1914
+ var isObjectCollection = / \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) / . test ( expression ) ;
1915
+ // If an array is used as collection
1916
+
1917
+ // if (isObjectCollection){
1918
+ //00000000000000000000000000000111111111000000000000000222222222222220033333333333333333333330000444444444444444444000000000000000556666660000077777777777755000000000000000000000088888880000000
1919
+ match = expression . match ( / ^ \s * (?: ( [ \s \S ] + ?) \s + a s \s + ) ? (?: ( [ \$ \w ] [ \$ \w ] * ) | (?: \( \s * ( [ \$ \w ] [ \$ \w ] * ) \s * , \s * ( [ \$ \w ] [ \$ \w ] * ) \s * \) ) ) \s + i n \s + ( ( [ \w ] + ) ? \s * ( | \s * [ \s \S ] + ?) ) ? (?: \s + t r a c k \s + b y \s + ( [ \s \S ] + ?) ) ? \s * $ / ) ;
1920
+
1921
+ // 1 Alias
1922
+ // 2 Item
1923
+ // 3 Key on (key,value)
1924
+ // 4 Value on (key,value)
1925
+ // 5 Collection expresion (only used when using an array collection)
1926
+ // 6 Object that will be converted to Array when using (key,value) syntax
1927
+ // 7 Filters that will be applied to #6 when using (key,value) syntax
1928
+ // 8 Track by
1916
1929
1917
1930
if ( ! match ) {
1918
1931
throw uiSelectMinErr ( 'iexp' , "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'." ,
@@ -1926,10 +1939,10 @@ uis.service('uisRepeatParser', ['uiSelectMinErr','$parse', function(uiSelectMinE
1926
1939
return {
1927
1940
itemName : match [ 4 ] || match [ 2 ] , // (lhs) Left-hand side,
1928
1941
keyName : match [ 3 ] , //for (key, value) syntax
1929
- source : $parse ( ! match [ 3 ] ? match [ 5 ] + ( match [ 6 ] || '' ) : match [ 5 ] ) , //concat source with filters if its an array
1930
- sourceName : match [ 5 ] ,
1931
- filters : match [ 6 ] ,
1932
- trackByExp : match [ 7 ] ,
1942
+ source : $parse ( ! match [ 3 ] ? match [ 5 ] : match [ 6 ] ) ,
1943
+ sourceName : match [ 6 ] ,
1944
+ filters : match [ 7 ] ,
1945
+ trackByExp : match [ 8 ] ,
1933
1946
modelMapper : $parse ( match [ 1 ] || match [ 4 ] || match [ 2 ] ) ,
1934
1947
repeatExpression : function ( grouped ) {
1935
1948
var expression = this . itemName + ' in ' + ( grouped ? '$group.items' : '$select.items' ) ;
0 commit comments