knockout.js - Durandal Compose module based on Conditional Statment -


i need use condition (if statement) dynamically select view compose in durandal. possible? has example me start? thank help.

you haven't given context problem simple (untested) example.

in html:

<div data-bind="compose: mymodel" /> 

in js file:

define(function (require) {     var m1 = require('module1');     var m2 = require('module2');      var mymodel;      mymodel = (1 === 1) ? m1 : m2;      return {         mymodel : mymodel     }; }); 

replace 1 === 1 condition, of course.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -