If necessary, you can add your own Knockout.js code to the automatically generated code. It is important to initialize the generated model with the following code:
@ko.Initialize(Model)
This method will create a model named viewModel
and fill it with data that is taken from the Model
parameter. Then, you can add custom JavaScript code and extend a model:
<script type="text/javascript"> viewModel.someProperty = someValue; </script>
After the necessary custom script is added, you should activate Knockout with the following code:
@ko.Apply(Model)