I am using knockout js in my simple application. knockout js works fine in my application. My problems is why VS 2013
or WebStorm
does not show any intellisense for knockout? Also it shows intellisense for jQuery
.
Currently my codes is :
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="Scripts/jquery-1.9.0.js"></script>
<script type="text/javascript" src="Scripts/knockout-3.0.0.js"></script>
<script type="text/javascript">
$(function() {
$("#jqueryTestId").html("Hello world, From jquery.");
});
</script>
</head>
<body>
<div>
name: <input type="text" data-bind="value: name"/> <br/>
You've clicked <span data-bind="text: numberOfClicks"></span> times
<button data-bind="click: incrementClickCounter">Click me</button>
</div>
<div id="jqueryTestId">
</div>
<script type="text/javascript">
var viewModel = {
numberOfClicks : ko.observable(0),
name : ko.observable(""),
incrementClickCounter : function() {
var previousCount = this.numberOfClicks();
alert(this.name("TestName"));
this.numberOfClicks(previousCount + 1);
}
};
ko.applyBindings(viewModel);
</script>
</body>
</html>
In WebStorm it does not show any intellisense. But in VS 2013 it only shows ko
in suggested list, but does not show observable
function like:
ko.observable();
How I can enable intellisense?
You just have to use the debug version of KnockoutJS i did and it autocompleted very well:
<script type="text/javascript" src="js/knockout-3.2.0.debug.js"/>
Knockout Debug Version
Hope this Fix your problem :)
Also this works well for "data-bind" tags: link
Using knockout.d.ts configured as a javascript library in Settings/libraries/javaScript, as @RP Niemeyer has suggested, is the best solution for WebStorm. Using minified knockout-3.0.0.js as a library doesn't currently work - see WEB-10723
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With