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
Post a Comment