为什么AngularJS的Hello World程序不起作用?

时间:2014-10-22 08:46:47

标签: javascript html angularjs

可以查看代码 http://jsfiddle.net/hh1mye5b/1/

<!doctype html>
<html ng-app="dcApp">
<head>
</head>
<body>
<div>
    <div ng-controller="SpeciesController">
        <label><h2>{{name}}</h2></label>

    </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script>
<script>
    var dcApp = augular.module("dcApp", [])
    dcApp.controller("SpeciesController",
            function ($scope) {
                $scope.name="Hello World"
            });
</script>

</body>

</html>

我尝试使用angularJS在{{name}}中显示<h2>,然而,我发现它没有用。有没有人有这方面的想法?

1 个答案:

答案 0 :(得分:5)

因为您使用了augular而不是angular

var dcApp = augular.module("dcApp", [])
// here -----^