我得到的错误角度没有定义

时间:2015-04-23 13:40:38

标签: javascript angularjs

我在尝试使用此设置进行角度调整时遇到问题。我想我在正确的位置引用了脚本。由于某种原因,不能工作。以下是代码...我在Chrome中遇到的错误是' angular未定义'。

<!DOCTYPE html>
<html data-ng-app = "demoApp">
<head>
    <title></title>
</head>

    <body>

    <div>
        <div data-ng-view="">
        </div>

    </div<


    <script src="angular.min.js"></script>


    <script>
        var demoApp = angular.module("demoApp", []);


        demoApp.config(function ($routeProvider){
                $routeProvider
                    .when('/view1',
                    {
                        controller: 'SimpleController',
                        templateUrl: 'partials/view1.html'
                    })
                    .when('/view2',
                    {
                        controller: 'SimpleController',
                        templateUrl: 'partials/view2.html'
                    })
                    .otherwise({ redirectTo: '/view1' });

        });



        demoApp.controller('SimpleController', function($scope){
            $scope.customers = [
            {name:'Nicholas Rodgers',city:'New Providence'},
            {name:'Michael Roker', city: 'Nassau Bahamas'},
            {name:'Jane Doe', city: 'Arizona California'}
            ];

            $scope.addCustomer = function(){
                $scope.customers.push(
                {
                    name: $scope.newCustomer.name,
                    city: $scope.newCustomer.city
                });
            };
        })




    </script>

    </body>

</html>

1 个答案:

答案 0 :(得分:1)

使用此链接获取角度js文件并检查您是否写错了&lt; / div&lt;标签

 <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>