Skip to content

Instantly share code, notes, and snippets.

@arantius
Created February 25, 2011 20:17
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/844416 to your computer and use it in GitHub Desktop.
Save arantius/844416 to your computer and use it in GitHub Desktop.
angular ng:switch + comment test case
<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org">
<head>
<script type="text/javascript" ng:autobind src="http://code.angularjs.org/0.9.10/angular-0.9.10.js"></script>
</head>
<body ng:init="value='foo'">
<p>The ng:switch construct fails when one of its children is a comment.</p>
<p>Works (when the bug isn't triggered on the same page):</p>
<ng:switch on="value">
<div ng:switch-when="foo">Value is foo.</div>
<div ng:switch-when="bar">Value is bar.</div>
</ng:switch>
<p>Fails:</p>
<ng:switch on="value">
<div ng:switch-when="foo">Value is foo.</div>
<!-- This comment causes a failure, when trying to .attr() the comment node. -->
<div ng:switch-when="bar">Value is bar.</div>
</ng:switch>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment