unable to get intellisense for knockout.js file

2019-07-18 13:23发布

问题:

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:

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