I'm working on a form to edit a row in a database table via REST/AngularJS. However I can't access the data, as I get a $scope.l undefined error on the web console. I wonder how would I be able to get the form working so I use the REST server to edit the existing content.
//CONTROLLER to edit a specific item
countryApp.controller('EditLocation', function($scope, $http, $routeParams, $location) {
//
var id = $routeParams.locid;
$scope.activePath = null;
$http.get('http://localhost/slimtest2/location/' + id).success(function(data) {
$scope.location = data;
});
$scope.editrel = function() {
var emP = {
location_id : id,
location_title : $scope.l.location_title,
location_latitude : $scope.l.location_latitude,
location_longitude : $scope.l.location_longitude
}
//convert data to JSON string
var lucy = JSON.stringify(emP);
alert(lucy);
$http.put('http://localhost/slimtest2/location/1/edit', lucy);
}
});
$scope.l?