0

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-controller Commented Jun 21, 2015 at 11:12

1 Answer 1

1

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 .

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.