不能得到与QUOT;的Hello World"与角JS工作工作、Hello、QUOT、JS

2023-09-14 23:08:52 作者:海绵.

我想沿着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}}

{{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>.

的例子: http://plnkr.co/edit/dBJmLr?p=$p$pview