本文介绍了不能得到与QUOT;的Hello World"与角JS工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想沿着AngularJS基本面PluralSight过程跟踪。这家伙的code和矿山如下:
I am trying to follow along a PluralSight course on AngularJS Fundamentals. The guy's code and mine is as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello World</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="css/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<header>
<h1 ng-controller="HelloWorldCtrl">{{helloMessage}}</h1>
</header>
<section>
</section>
<footer>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script type="text/javascript">
function HelloWorldCtrl($scope) {
$scope.helloMessage = "Hello World";
}
</script>
</body>
</html>
然而,它适用于他,不适合我!我究竟做错了什么?似乎是一个pretty简单的设置给我,但它不是为我工作。我没有得到的Hello World,而不是我得到:
Yet it works for him and does not for me! What am I doing wrong? Seems like a pretty simple setup to me, yet it isn't working for me. I am not getting Hello World, instead I get:
{{helloMessage}}
任何帮助将大大AP preciated。
Any help would be greatly appreciated.
推荐答案
NG-应用
你的 HTML
标记中的属性。是这样的:&LT; HTML NG-应用&GT;
Add ng-app
attribute inside your html
tag. Like this: <html ng-app>
.
的例子:
这篇关于不能得到与QUOT;的Hello World&QUOT;与角JS工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!