“错误:[ng:areq]参数'HelloHell'不是函数,未定义

时间:2016-10-22 11:01:32

标签: angularjs

请告诉我,我正在做Worng

<div ng-app="customCharts">

    <div ng-controller="HelloHell">

    </div>
</div>

var app = angular.module('customCharts', []);


var app = angular.module('customCharts', ['dx']);

app.controller("ChartController", function ($scope, $http, $q) {
    $scope.productSettings = {
        dataSource: new DevExpress.data.DataSource({
            load: function () {
                var def = $.Deferred();
                $http({
                    method: 'GET',
                    url: 'http://localhost:53640/Home/PostChart'
                }).success(function (data) {
                    def.resolve(data);
                });
                return def.promise();
            }
        }),
        series: {
            title: 'Displays Product Costs for items in our Database',
            argumentType: String,
            argumentField: "Name",
            valueField: "Cost",
            type: "bar",
            color: '#008B8B'
        },
        commonAxisSettings: {
            visible: true,
            color: 'black',
            width: 2
        },
        argumentAxis: {
            title: 'Items in Product Store Database'
        },
        valueAxis: {
            title: 'Dollor Amount'
        }
    }
})

Json控制器     public JsonResult PostChart()             {                 var prod = new List();                 使用(Ctxdb db = new Ctxdb())                 {                     var product = db.Products.ToList();                     foreach(产品中的var p)                     {                         var thing = new {Name = p.ProductName,Cost = p.Price};                         prod.Add(事);                     }                 }                 返回Json(prod,JsonRequestBehavior.AllowGet);             }

1 个答案:

答案 0 :(得分:0)

HTML中的控制器应该是

<div ng-controller="ChartController">

你也应该有一个模块

var app = angular.module('customCharts', []);