0
我從Silverlight到Knockout.js。當我在Silverlight創建的ViewModels,我會時常有這樣的事情:在視圖模型中使用自定義對象Knockout
public class MyViewModel : ViewModel
{
private MyCustomClass custom = null;
public MyCustomClass Custom
{
get { return custom; }
set { custom = value;
NotifyPropertyChanged("MyCustomClass");
}
}
}
<TextBox Text="{Binding Path=Custom.PropertyName, Mode=TwoWay}" />
但是,我不知道該怎麼辦了這樣的事情在Knockout.js。目前,我有:
<input type="text" data-bind="value:propertyName" />
var viewModel = {
custom: {
propertyName:""
}
}