2

i am working on asp.net website and we are using knockout.js. I am not able to get javascript intellisense for knowkcout.js file. I tried adding the below snippet but still i am not getting any intellisense.

<% if(false){ %>
    <script src="knockout-2.0.0.js" type="text/javascript"></script>
<% } %>

This is how my head block looks like:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<% if(false){ %>
    <script src="knockout-2.0.0.js" type="text/javascript"></script>
<% } %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script src="jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
    <script src="json2.js" type="text/javascript"></script>
    <script src="knockout-2.0.0.js" type="text/javascript"></script>
    <script type="text/javascript">


    $(function() {

function viewModel() {
    firstName = ko.observable();
    lastName = ko.observable();

}

    ko.applyBindings(new viewModel());




 });
    </script>
1
  • Try putting it in the head tag as well?
    – Umair
    Mar 1, 2012 at 15:39

1 Answer 1

5

Put along with the knockoutjs.2.0.0.js file an other one - debug version of kcnockoutjs knockout-2.0.0.debug.js and Visual Studio would be able pick intellisense up. You do not need including this file using <script src="" .. />.

Works for me on Visual Studio 2010

Download knockout-2.0.0.debug.js — Knockout 2.0.0 (debug build) from CodePlex

5
  • not sure i am able to follow you but i added debug file using <script src="knockout-2.0.0.debug.js" type="text/javascript"></script>. still no luck. I have debug and prod version of these files. can you post your markup in the answer please?
    – Asdfg
    Mar 1, 2012 at 15:44
  • @Asdfg : remove <script src and just copy this file along with 2.0.0.js, dows this help? Which version of VS are you using?
    – sll
    Mar 1, 2012 at 15:47
  • i m using visual studio 2008. you mean copy it to the same folder as 2.0.0.js file is in and remove references to the debug.2.0.0.js file from the markup?
    – Asdfg
    Mar 1, 2012 at 15:49
  • @Asdfg : exactly, but I've not checked this with VS2008, hope it helps
    – sll
    Mar 1, 2012 at 15:52
  • Just checked, I'm using Visual Studio 2011 Dev preview
    – sll
    Mar 13, 2012 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.