Building your own libraries
Again, we are calling our custom components KOmponents. We will be creating a number of library solutions over time and welcome others to join in. Tags will not do everything for us, as there are some limitations yet to be conquered. That doesn't mean we wait for all the features before doing the ones we can for now. In the previous chapter, we showed a KOmponent
tag for using templates. That is also included in the base KOmponent library.
In this segment of the chapter, we will also be showing some tags from our Bootstrap KOmponents
library. First we will need to include the Bootstrap KOmponents
library:
<script src="/share/js/knockout.komponents.bs.js"></script>
Above viewModel
in our script, we need to add a function to make this section of code simpler. At times, when passing items into observables, we can pass in richer bound data using a function like this. Again, create this function above the viewModel
declaration of the script, shown as follows...