Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Describe what you would expect to happen in terms of DOM when you click on buttons. From your code it's not clear what you're trying to do. Are you trying to maintain a "selected" assignment? Commented Feb 5, 2014 at 0:40
  • Also, notice that you're over shadowing variables inside of your ng-repeats. What I mean is, on the outer block, you assign a string 'one' to assignment, but then on your repeater blocks, you have the iterator variable with the same name assignment that you then assign to within the block. You should try changing the name of the property you use to track which is selected to something like selectedAssignment. Commented Feb 5, 2014 at 0:47
  • I think that I've altered my code according to what you mentioned, but I'm still not quite clear. The modified code above does not work. Commented Feb 5, 2014 at 1:02
  • Did you read my answer below? Ng-switch is for hardcoded (non-dynamic) conditions. Try looking at the docs, see what other directives would swap out the DOM dynamically depending on a certain condition, like ng-if. Commented Feb 5, 2014 at 1:11
  • Ok. I wasn't sure if your more recent comment negated anything that you'd mentioned before. I'll take a look. Sorry about that. Commented Feb 5, 2014 at 1:28