0
我是新来的淘汰赛,看过帖子广泛,但不能简单的例子,在Visual Studio 2015年运行knockoutjs的hello world将不会运行
总是得到所有的HTML标签标记为类型或命名空间的问题调试器,当运行时,我看到空箱子。
下面是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Home Page</title>
<script type='text/javascript' src='jquery-1.10.2.min.js'></script>
<script type='text/javascript' src='knockout-20.3.0.debug.js'></script>
</head>
<body>
<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2>
<script type="text/javascript">
// Here's my data model
function viewModel() {
this.firstName = ko.observable('Planet');
this.lastName = ko.observable('Earth');
this.fullName = ko.computed(function() {
// Knockout tracks dependencies automatically.
return this.firstName() + " " + this.lastName();},this);
};
ko.applyBindings(viewModel()); // This makes Knockout get to work
</script>
</body>
</html>
请添加更多上下文。什么是您使用的项目模板?你的项目/解决方案结构如何? – rawel
你确定淘汰赛脚本版本“knockout-20.3.0”吗?或者它应该是'knockout-2.3.0'? – gkb