很想知道你们(和gals)在ViewModel中使用什么来访问ModuleId,TabId或TabModuleSettings?
通常我最终会做类似
的事情var localSettings = {
"mid": "<%= ModuleId%>",
"lid": "<%= loadId%>",
"priceOverride": "<%= Settings[FmSettings.PartCostOverride] != null
? Settings[FmSettings.PartCostOverride].ToString()
: String.Empty%>",
"productOverridePrefix": "<%= Settings[FmSettings.PartNumberOverridePrefix] != null
? Settings[FmSettings.PartNumberOverridePrefix].ToString()
: String.Empty%>",
"productOverrideSuffix": "<%= Settings[FmSettings.PartNumberOverrideSuffix] != null
? Settings[FmSettings.PartNumberOverrideSuffix].ToString()
: String.Empty%>"
};
然后将其传递给我的vm
ko.applyBindings(new CalculatorViewModel(localSettings));
快速失控..我考虑使用ajax但感觉有点矫枉过正
您使用什么来初始化包含大量数据的视图模型?