0
votes

Here is section of code applied on

  <div class="container" data-ng-app="myApp" ng-controller="hController">
  <li ng-repeat="x in names">
        {{ x.Name + ', ' + x.Country }}
    </li>
    </ul>

Controller Implementation

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost:8080/rest/hotel")
.success(function(response) {$scope.names = response.records;});
});
</script>
</head>

Error i can see in web console

Error: [ng:areq] http://errors.angularjs.org/1.3.14/ng/areq?p0=hotelController&p1=not%20a%20function%2C%20got%20undefined at Error (native) at http://localhost:8080/resources/js/angular.min.js:6:417

i have already added angular.min.js in path

1
the name of the controller is customersCtrl, change ng-controllerSajal

1 Answers

1
votes

conflicts in naming of your controllers

  app.controller('customersCtrl'....) 

and in the Template you have used "hController"

 <div class="container" data-ng-app="myApp" ng-controller="hController">

Use the same name in both the places or else angular doesn't find the the directive ng-controller defined in your Template and hence produces error out . ng-controller is a angular built-in directive which attaches controller to the view .