Attach the layout. Layout to the body

I have a puppet that I want to bind directly to the page element.

App.Views.Layouts.Unauthenticated = Backbone.Marionette.Layout.extend template: "layouts/unauthenticated" regions: content: "#content" header: "#header" footer: "#footer" views: {} initialize:-> @el = $("body") @delegateEvents() 

and then in the application, I do it

 App.layouts.unauthenticated = new App.Views.Layouts.Unauthenticated() App.layouts.unauthenticated.render() 

The layout is not attached to the page. How to attach it to the body, while I already used the body as "el", since I do not need additional wrappers.

+4
source share
1 answer

You need to set el in the view definition, not in the initializer.

 App.Views.Layouts.Unauthenticated = Backbone.Marionette.Layout.extend el: "body" template: "layouts/unauthenticated" regions: ... 
+6
source

Source: https://habr.com/ru/post/1443622/


All Articles