I am trying to connect to several REST services through different controllers on angularjs but after one connects the others wont
Here is the REST service that is connected through a controller.js file
angular.module("itsBooking").controller("bookingController", function ($scope, $http) {
$scope.init = function () {
$http.get("http://webteach_net.hallam.shu.ac.uk/acesjas/api/booking/")
.success(function (response) {
$scope.bookings = response;
})
.error(function (error) {
$scope.errorMessage = error;
});
};
$scope.init();
});
And here is the one currently not connecting. The link is working so i'm not sure what i'm doing.
angular.module("itsVehicle").controller("vehicleController", function ($scope, $http) {
$scope.init = function () {
$http.get("http://webteach_net.hallam.shu.ac.uk/acesjas/api/vehicle/")
.success(function (response) {
$scope.cars = response;
})
.error(function (error) {
$scope.errorMessage = error;
});
};
$scope.init();
});
Here is the html that would display the one that is not currently connecting
<div ng-controller="vehicleController">
<form>
<p>Search for Vehicles <input type="text" ng-model="search"></p>
</form>
<p>
Here are your current vehicles
</p>
<table>
<tr>
<th>ID</th>
<th>Make</th>
<th>Capacity</th>
<th>Driver</th>
<th>Registration</th>
<th>Model</th>
</tr>
<tr ng-repeat="car in cars | filter:search">
<td>{{car.Id}}</td>
<td>{{car.Make}}</td>
<td>{{car.Capacity}}</td>
<td>{{car.Driver}}</td>
<td>{{car.Registration}}</td>
<td>{{car.Model}}</td>
</tr>
</table> <br />
</div>
I have modules for each controller and a js to link all the modules together
Any help would be great.
Thanks, SM