0

What I'm trying to achieve here is to remove/disable the selected role after saving my selection. PLUS, if I press the X button at the panel below to remove my list of selections, I will be able to re-populate the list with the deleted roles recovered.

Screenshot of what I'm trying to achieve:

Choose role

And at the moment, this is what I have:

controller js: http://pastebin.com/LDYrJQyf

html: http://pastebin.com/39G01ARm

3
  • Barak gave me the idea of unique ID. So I played around by passing the selected item with ng-model then compare the IDs with my original list and if it matches, it will then splice off the index of the for loop. I then use the same approach to my re-addition by grabbing the selectedRoles[i].role and push it into the roles list. Commented Jul 22, 2016 at 3:51
  • create a plunker or else it will be difficult becz from your JS u are using $http.get('/skill/get/all/roles') call Commented Jul 22, 2016 at 4:03
  • Thanks for wanting to mark this as solved. To do so, please accept/tick an answer below, making a new self-answer if necessary. Thanks! Commented Jul 22, 2016 at 23:37

1 Answer 1

1

Instead of using the $index. why not pass the id of selectedSkills given that it is an object and has a unique id. It would automatically update the table once you push it back.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.