Disposer
Disposer

Reputation: 6371

angular argument is not a function, got undefined

In my html page I get the below error

Error: [ng:areq] Argument 'quickReportController' is not a function, got undefined

I searched and found a lot of solutions but not none of them was helping

The html file

<html>
<head>
    ...
    <script src="~/Scripts/jquery-2.1.3.js"></script>
    ...
    <script src="~/Scripts/angular.js"></script>   

    <script>
    </script>   
</head>

<body style="font-family: tahoma;" ng-app>

<div class="container bootcards-container" ng-module="myModule">

    <div class="row" ng-controller="quickReportController">
        <h3>{{name}}</h3>
    </div>

</div>

<script type="text/javascript">
    (function () {
        var module = angular.module('myModule', []);
        module.controller("quickReportController", ['$scope', function ($scope) {
            $scope.name = "dd";
        }]);
    }());  
</script>

</body>
</html>

Upvotes: 0

Views: 211

Answers (2)

Mathieu Bertin
Mathieu Bertin

Reputation: 1624

Have you tried to use ng-app="myModule" and remove ng-module from your html?

Upvotes: 1

Naeem Shaikh
Naeem Shaikh

Reputation: 15715

you have missed to define ng-app, it should be ng-app='myModule', only using

 <body style="font-family: tahoma;" ng-app>

will try to find global controller named quickReportController, ehich is not global.

Replace with this:

   <body style="font-family: tahoma;" ng-app='myModule'>


Also You are trying to define ng-module and nd ng-app, so read this https://stackoverflow.com/a/22865917/3556874

Upvotes: 1

Related Questions