Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
115
rated 0 times [  118] [ 3]  / answers: 1 / hits: 29690  / 10 Years ago, wed, september 3, 2014, 12:00:00

I have a simple JavaScript object that looks like this:



$scope.obj = { 'Architect': [asdf,d,e,y]};


I'd like to show the values of 'Architect' in a select box. However, the single quotes are throwing me off when trying to do the ng-repeat.



<select>
<option ng-repeat=row in obj['Architect'] value={{row}}>{{row}}</option>
</select>


That does not populate the select box, it just shows an empty select box. I assume it is interpreting the single quotes as a string literal, but even if I add single quotes and escape them, it still doesn't work as expected. Am I missing something?



Here is a sample plunker:


More From » angularjs

 Answers
7

escape the quotes How to properly escape quotes inside html attributes?



<option ng-repeat=row in obj[&quot;'Architect'&quot;] value={{row}}>{{row}}</option>


http://plnkr.co/edit/6xUD3Zg0jxV05b41f2Gw?p=preview


[#69574] Sunday, August 31, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eden

Total Points: 730
Total Questions: 117
Total Answers: 117

Location: Peru
Member since Fri, Oct 14, 2022
2 Years ago
;