I tried to implement user name displaying after log in. It displays in top menu. But top menu is getting displayed before log in, so it user name is getting cached.
I tried many approaches, and using volatile() is seems the best option, but it doesn’t work. In this simple example currentTime calculates only once:
<script type="text/x-handlebars" data-template-name="application">
{{currentTime}}
</script>
App.ApplicationController = Ember.Controller.extend({
currentTime: function() {
console.log('computing value');
var time = new Date();
return time;
}.property().volatile()
});
Actually, I can’t find ANY way do display dynamic value in Ember’s application template. Tried to display value from another controller using {{render}} helper, value still gets cached.
The problem is that the template is only requesting the value once. How could it know that the time is changing? It would need to request the value on every frame.