Jquery Uncaught对象angular.js:3650

时间:2014-06-05 06:39:21

标签: javascript jquery angularjs

我参考下面的简单饼图示例,我下载了它。

http://rendro.github.io/easy-pie-chart/

<html lang="en" ng-app="app">
<head>

    <link href="~/Content/style.css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="~/Content/canvas.js"></script>
    <script src="~/Content/easypiechart.js"></script>
    <script src="~/Content/easypiechart.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>

</head>
<body>

    <div class="angular" ng-controller="chartCtrl">
        <span class="chart" easypiechart ng-init="options = { animate:false, barColor:'#E67E22', scaleColor:false, lineWidth:3, lineCap:'butt' }" percent="percent" options="options">
            <span class="percent" ng-bind="percent"></span>
        </span>
        <input type="range" min="-100" max="100" step="1" ng-model="percent" />
        <span class="chart" easypiechart percent="anotherPercent" options="anotherOptions">
            <span class="percent" ng-bind="percent"></span>
        </span>
        <input type="range" min="-100" max="100" step="1" ng-model="anotherPercent" />
    </div>



    <script>
        var app = angular.module('app', ['easypiechart']);
        app.controller('chartCtrl', ['$scope', function ($scope) {
            $scope.percent = 65;
            $scope.anotherPercent = -45;
            $scope.anotherOptions = {
                animate: {
                    duration: 0,
                    enabled: false
                },
                barColor: '#2C3E50',
                scaleColor: false,
                lineWidth: 20,
                lineCap: 'circle'
            };
        }]);
    </script>
</body>
</html>

编辑:

我只运行上面的代码,但我得到以下错误

Uncaught object angular.js:3650

错误图片: enter image description here

我到底错过了什么?

我尝试更改脚本文件的位置,但它没有解决问题。

感谢。

3 个答案:

答案 0 :(得分:2)

您需要在 html 中加入AnugularJS,如下所示:

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

DEMO

答案 1 :(得分:1)

可能是你错过了角度js文件..

在头部添加此内容,然后尝试...

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

答案 2 :(得分:1)

您好,您能看到此链接一次,这可能会解决您的问题,导入角度和easypiechart的顺序会导致错误

https://github.com/rendro/easy-pie-chart