angularjs - Error: [ng:areq] Argument 'xController' is not a function, got undefined -


i using angular v1.4.2, , keep getting "error: [ng:areq] argument 'accountregisterctrl' not function, got undefined" below controller defination

(function(app) {      'use strict';      function accountregisterctrl($scope, $window) {         //........          $scope.previous = function () {             $window.history.back();         }     }      app.controller('accountregisterctrl', ['$scope', '$window', accountregisterctrl]);  }(angular.module('accountregister'))); 

can body of help!

this error occurs in general if misspeled controller html view or route definitions :

<div data-ng-controller="accountregisterctl"> <!-- wrong -->     // ui stuff ... </div> 

here accountregisterctl controller called during compilation step, didn't exists because misspelled: accountregisterctrl correct controller name.

<div data-ng-controller="accountregistercrtl"> <!-- correct -->     // ui stuff ... </div> 

or controller.js not injected in index.html


Comments