Angular controller is not registered error

In my case, it was missing reference in index page as well as my controller name was startupController (notice lower case s) and I was trying to register it with StartupController (upper case s)


Its because of your Immediately Invoked Function Expression. you have to change it like below :

var myApp = angular.module("myApp", []);

(function(app){
  "use strict";
  app.controller("productController", function($scope, $http){
    $http.get('data/data.json').then(function(prd){
      $scope.prd = prd.data;
    });
  });
})(myApp);

Just import the file in index.html,

<script src=".../productController.js"></script>

Tags:

Angularjs