0

I have not seen the solution to this in: https://handlebarsjs.com/ or https://github.com/jknack/handlebars.java

  1. To override a template I need to:
{{#block "newFile" override="oldFile.hbs"}}

  1. I also know that I can override elements while not losing the rest of the material by:
        {{#element "oldElement" noWith=true}}

  1. But how do I override the entire page? I want to save time by extending a ViewModel based on another ViewModel, rather than creating a new ViewModel directly based on the original Model, but I want a similar ViewModel with a different View.
Matthew
  • 91
  • 3
  • 10

1 Answers1

0

The answer is very simple:

Put this as a container around every inherited View you do not want:

{{#unless newViewModel}}

{{/unless}}

where newViewModel is a boolean set to true in your new ViewModel.

Then you can extend the ViewModel without extending its View.

Matthew
  • 91
  • 3
  • 10