Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-option issue #61

Closed
rgolea opened this issue Oct 5, 2014 · 6 comments
Closed

ng-option issue #61

rgolea opened this issue Oct 5, 2014 · 6 comments

Comments

@rgolea
Copy link

rgolea commented Oct 5, 2014

Hi people... I came with this problem before but I haven't been taken seriously.

Ng-option doesn't work properly. I should be able to compare objects rather than put my selection in a different variable.

It should see that if I declare a parameter in, for example a users variable, where I declare what that user works, and then I declare all the jobs out there, it should compare that property and not make me work around it.

Please take me seriously this time.
Thanks.

PS: Really good job.

@kumarharsh
Copy link

Some example to illustrate what you're saying would be swell!!

@rgolea
Copy link
Author

rgolea commented Oct 8, 2014

My HTML

<select ng-model="selected" ng-option="color.name for color in colors"></select>

My Controller

$scope.colors = [
      {name:'black', shade:'dark'},
      {name:'white', shade:'light'},
      {name:'red', shade:'dark'},
      {name:'blue', shade:'dark'},
      {name:'yellow', shade:'light'}
    ];

//next line is how it works
$scope.selected = $scope.colors[2];

//next line is how I really need it to work

$scope.selected = {name:'red', shade:'dark'};

I've been searching everywhere in the API. If there is a method and I haven't found it please put an example in the API. On other sites I could only find workarounds.

Thank you.

@kumarharsh
Copy link

So, you want to "COPY" the selected object?

@rgolea
Copy link
Author

rgolea commented Oct 8, 2014

Well... first of all I am copying the object to my database. Now I'm trying to edit it so I need to compare both objects.

@mhevery
Copy link
Contributor

mhevery commented Oct 8, 2014

This is the wrong repo. I think you may want to start on StackOverflow first or AngularJS repo.

@mhevery mhevery closed this as completed Oct 8, 2014
usernamealreadyis pushed a commit to xccvv/commands that referenced this issue Mar 13, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants