Durandal, RequireJS, KnockoutJS
I have a generic and a client specific view in my project.
│ faq.html
│ welcome.html
│ shell.html
│
├───Client1
│ faq.html
│
├───Client2
│ faq.html
│ welcome.html
I want to show the client specific view if it exists or else show the default view.
Something like this.
<div>
<div data-bind="compose: { view:'views/Client1/faq.html', fallbackView: 'view/faq.html' }"></div>
</div>
I think you're better off handling this in your view-model than in your view. Durandal lets you use an observable property for its compose binding so you can do something like this:
...
Trying to load the view path twice seems a bit redundant of course but if you don't have any other way to know if the view exists or not then it might be your best bet.