Consider the below snippet in Handlebar written for Ember.js:
<script type="text/x-handlebars" id="courses/selectedCourse">
<div id="selectedCourse">
{{#if IsRegistered}}
<div class="XX">
Registered for the course
</div>
{{else}}
<div class="YY">
<button {{action registerForCourse}}>Register</button>
</div>
{{/if}}
<h1>{{courseTitle}}</h1>
<div class="selectedCourseItem">
<img id="selectedCourse" {{bindAttr src="imageUrl"}}/>
</div>
</div>
</script>
Issue1 : Content is not getting refreshed immediately after Registering for a course.
Issue2 : On changing the selected courses couple of times, the content is displayed twice and overlapping.
Following is the message I see in FireBug:
TypeError: node is undefined
[Break On This Error]
node.unchain(key, path);
If I remove the #if
statement, everything works well.
What am I doing wrong?