AngularJS Error: $controller:ctrlreg The controller is not registered

Last Reply one year ago By dharmendr

Posted one year ago


I am getting error like this-

controller register error in angular js code.


<div data-ng-app="myModule" class="container-fluid">        
    <div data-ng-controller="HomePagePhotosController" class="container">
        <div class="row">
            <div class="col-sm-12 col-md-12 col-lg-12 pagemargin" style="padding: 0px">
                <p class="aboutheading">
                    Our Gallery
                <p class="aboutborder1" style="">
                <div id="owlslider" class="owl-carousel owl-theme">
                    <div data-ng-repeat="p in GallaryPhotos" on-finish-render="getHomePageGallarySlider();"
                        <img data-ng-src="{{p.PhotoPath}}" class="img-responsive owl" />


Error: [$controller:ctrlreg]$controller/ctrlreg?p0=msgController
    at angular.js:99
    at angular.js:11677
    at ea (angular.js:10708)
    at p (angular.js:10493)
    at g (angular.js:9832)
    at g (angular.js:9835)
    at angular.js:9697
    at angular.js:1965
    at m.$eval (angular.js:19393)
    at m.$apply (angular.js:19492)


var app = angular.module('myModule', ['ngRoute']);
app.controller("msgController", function msgController($scope, $http) {

    $scope.Messages = [];
        method: 'Get',
        url: '/Home/GetMessageDetails'
    }).then(function (response) {

        $scope.Messages =;
        //    console.log($scope.Messages);

    }, function (error) {
        $scope.message = 'Unexpected Error';



Posted one year ago

Hi iammann,

Your Html does not contain a div having data-ng-controller as msgController.

So assign data-ng-controller as msgController to an elemen.