Saturday, June 18, 2016

ASP.NET MVC 5 From Scratch : Add KnockoutJs to Project With NuGet

In this blog we will add the KnockoutJs JavaScript library to our MvcApp project. KnockoutJs is a great lightweight data binding library. Follow the steps below to add KnockoutJs to your ASP.NET MVC project.

2. In right hand side type in "knockoutjs", then click on the "Install" button next to the knockoutjs package

3. You should see a green checkmark after you finished adding the knockoutjs library to the MvcApp project.

4. In the "Scripts" folder you will see the knockout JavaScript files

5. Now that we have the knockoutjs files we need to add the files to the BundleConfig.cs file to register them

6. Open the BundleConfig.cs file in the "App_Start" folder type the following lines of code inside the RegisterBundles method, this tells MVC to include any files in the "Scripts" folder that starts with the string "knockout"