I have a resource defined as so:
this.resource('settings', {path: '/settings'});
The route handler for the resource looks like this,
App.SettingsRoute = Ember.Route.extend({
model: function() {
var route = this;
return App.User.find('current').then(function (user) {
var transaction = route.get('store').transaction();
var settings = App.MemberSettings.find(user.get('username'));
transaction.add(settings);
return settings;
});
},
events: {
saveSettings: function(settings) {
settings.get('transaction').commit();
}
}
});
On the template (data-template-name=“settings”), I am binding to the model property as so:
{{view Em.TextField valueBinding="first_name" classBinding="errors.first_name.length:error"}}
The value binds correctly if I enter the route via the URL but does not bind while I transition to the route using the linkTo helper.
Since the resource does not have dynamic segment, following rule should apply (taken from official documentation):
Note: A route with a dynamic segment will only have its model hook called when it is entered via the URL. If the route is entered through a transition (e.g. when using the linkTo Handlebars helper), then a model context is already provided and the hook is not executed. Routes without dynamic segments will always execute the model hook.
Does anyone have any idea on why the valuebinding fails?
Thanks,
Prashant