How to set layoutName for all views except one


#1

Hi, i’m trying to set the “layoutName” property for all views except one or two. I don’t have the view files, only its templates. And until now the only way i found to do this is to create a view file for each template and code the layoutName there.

Is there any way to do this like the ideas below?

Ember.views.each(function(view){ 
  if(layoutName != "otherView"){
    view.layoutName = "myLayout";
  }
});

#2

Nope, you need to create the view classes to achieve that. Ember.View is used lots internally and overriding layoutName globally will break everything.


#3

Thanks for helping me out. Would you mind to take a look at infinite loop between Ember.View.extend and Ember.View.reopen and give your oppinion again? It’s basically the same thing, but in my tryings to acomplish this i ended up with another interesting side effect.


#4

It will not work - you tried to do it anyway but it won’t work. You cannot do it. You have to specify it manually for the views you want it for.