Skip to content

Instantly share code, notes, and snippets.

@arantius
Created February 17, 2011 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arantius/832513 to your computer and use it in GitHub Desktop.
Save arantius/832513 to your computer and use it in GitHub Desktop.
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<head>
<title>Angular Newline-In-Option Test</title>
<script src="http://code.angularjs.org/angular-0.9.10.min.js" ng:autobind></script>
</head>
<body ng:init='event={};sites=[{"id": "96b1a3ce-0b26-40df-8f5a-2017f5a7fcbd", "name": "Name Only"}, {"id": "983aea62-b6a7-4e0a-bde1-5c48eb3ad19e", "name": "Check Box Condition Only"}]'>
<p>With newlines inside the option node, fail:</p>
<select name="event.site1" id="location">
<option value="">Please select...</option>
<option ng:repeat="site in sites" value="{{site.id}}">
{{site.name}}
</option>
</select>
<p>Without, OK:</p>
<select name="event.site2" id="location">
<option value="">Please select...</option>
<option ng:repeat="site in sites" value="{{site.id}}">{{site.name}}</option>
</select>
<p>Inspect the (generated) source, or the bound model below. The content of the option node is incorrectly assigned as the value, rather than the value attribute's contents.</p>
<pre>{{event}}</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment