What to do with templates that bind to global objects?

I’ve been using some Ember objects in my code, such as “App.SelectedBlock” to access selected items in lists (a practice that started when I was using Sproutcore years ago) and now it looks like binding to these objects from the Handlebars templates is going to be deprecated and I’m not sure how to go about fixing that. I’m running Ember 1.8.1 and right now it will still work but I’ll get “DEPRECATION: Global lookup of App.SelectedBlock from a Handlebars template is deprecated.” and I’m pretty sure it’s full removed in 1.9.0. I’m not sure how to go about fixing this without having to completely restructure my code. Any suggestions?

For example: App.SelectedBook = Ember.View.extend({ name: ‘selectedBook’, });

Now you can use {{view “selectedBook”}} in your handlebar. Here is the official part from the documentation: http://emberjs.com/guides/views/inserting-views-in-templates/ However I couldn’t make it run with the attribute “templateName” so I used “name” instead.

Hope this helps!

1 Like