Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

choice ng-repeat doesn't allow for "(key,value) in object" #247

Closed
tannerlinsley opened this issue Oct 1, 2014 · 34 comments
Closed

choice ng-repeat doesn't allow for "(key,value) in object" #247

tannerlinsley opened this issue Oct 1, 2014 · 34 comments
Milestone

Comments

@tannerlinsley
Copy link

http://plnkr.co/edit/JHKjnlzaAhecwH5K4yLr?p=preview

<div class="form-group">
    <ui-select ng-model="selectedBlah" theme="bootstrap">
        <ui-select-match placeholder="Choose a blah...">{{$select.selected}}</ui-select-match>
        <ui-select-choices repeat="(key, value) in blahs | filter: $select.search">
            <div ng-bind-html="key"></div>
        </ui-select-choices>
    </ui-select>
</div>
@derekperkins
Copy link

👍

@kumarharsh
Copy link

Yes, it's not supported... kinda ticked me off too....

+1 for the support.

@tannerlinsley
Copy link
Author

Is this on the roadmap? Or has this not been implemented because of restrictions with angular? I've heard that angular doesn't offer a native filter for ng-repeat="(key, value) in object", but are there ways around that?

@ghost
Copy link

ghost commented Oct 14, 2014

+1 for the support on this.. This is the only thing preventing me from using ui-select!

@yaru22
Copy link

yaru22 commented Oct 28, 2014

+1 for this as well.

1 similar comment
@lanbuithe
Copy link

+1 for this as well.

@amcdnl
Copy link
Contributor

amcdnl commented Nov 19, 2014

It would be interesting to see how single value binding would work with this.

@TheYves
Copy link

TheYves commented Dec 2, 2014

+1 would be very helpful

@simeg
Copy link

simeg commented Dec 9, 2014

+1 Cannot use ui-select because of this.

@amcdnl
Copy link
Contributor

amcdnl commented Dec 9, 2014

You could always use Object.keys() to make an array

@simeg
Copy link

simeg commented Dec 10, 2014

@amcdnl Thanks, but I had to use another directive. Too bad, ui-select is awesome when it works!

@ghost
Copy link

ghost commented Dec 12, 2014

@amcdnl Thanks for the tip. I am currently using Object.keys() as a workaround in one of my projects, but it is just that - a workaround.

@vvolodin
Copy link

+1

@franckamayou
Copy link

+1 for this

@shahzadns
Copy link

+1

4 similar comments
@jaroslavrehorka
Copy link

+1

@codesu
Copy link

codesu commented Mar 31, 2015

+1

@sjmorrow
Copy link

+1

@vimota
Copy link

vimota commented Apr 7, 2015

+1

@kumarharsh
Copy link

Stop writing +1 now. I think if the developer is interested in implementing this, he'll get around to doing it. +1's are not adding any weight apart from elongating this list.

@codesu
Copy link

codesu commented Apr 9, 2015

just for fun...lol.

@kamikaze
Copy link

kamikaze commented May 6, 2015

+1

1 similar comment
@mattmcardle
Copy link

+1

@anwfr
Copy link

anwfr commented Jun 10, 2015

+2

@mcianc
Copy link

mcianc commented Jun 26, 2015

+1

3 similar comments
@gui-com-pt
Copy link

+1

@JrSchild
Copy link

+1

@belerweb
Copy link

belerweb commented Aug 8, 2015

+1

@dimirc dimirc added this to the 0.13.x milestone Aug 24, 2015
@dimirc
Copy link
Contributor

dimirc commented Sep 27, 2015

PR #1208 should resolve this. Let me know comments

@dimirc dimirc closed this as completed Sep 29, 2015
@ebergama
Copy link

@dimirc thank you for your update.
I took a look into the code and I've noticed that your solution only works with an object called peopleObj.

//When an object is used as source, we better create an array and use it as 'source'
    var createArrayFromObject = function(){
      $scope.$uisSource = Object.keys(originalSource($scope)).map(function(v){
        var result = {};
        result[ctrl.parserResult.keyName] = v;
        result.value = $scope.peopleObj[v];
        return result;
      });
    };

I created the PR with the fix here: #1217

@dimirc
Copy link
Contributor

dimirc commented Sep 30, 2015

@ebergama my bad. Merged, thanks!

@ShvecovProject
Copy link

+1

1 similar comment
@ShaneF67
Copy link

+1

@dragonhaimax
Copy link

+1s

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests