I am trying to get data from the database then display the data in input form as default. I'm using angularjs $http get method
to retrieve the data but failed.
My laravel route
Route::group(array('prefix' => 'api', 'before' => 'csrf'), function() {
Route::get('student', function() {
$name = Student::where('name')->first();
return Response::json($name);
});
}
Angularjs
.controller('syncApiCtrl', function ($scope, $timeout, Module, $http) {
$http.get('api/student').success(function(data) {
$scope.name = data;
console.log(data);
});
...
I would like to get the name from the Student table but the result return to me is something like
Result
<!DOCTYPE html><!--[if lt IE 7]> <html lang="en" class="no-js lt-ie9 lt-ie8 lt-ie7">