This might be a stupid question as i am new to Laravel. I am making single page application using angular and laravel. i am trying to get all records from "todos" table and display them to todo.html on click of a "View all Todos" button. "View all Todos" goes to "localhost:8000/tasks" URL. When i click on that button i got all the todos fine no problem. But when i try to access that url directly on browser i got json array from laravel Todocontroller.
here is my route/web.php
Route::resource('/todo', 'TodoController');
Laravel TodoController controller
public function index()
{
return Todo::all();
}
here is my angular code
myApp.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider.when('/', {
templateUrl: 'views/home.html',
});
$routeProvider.when('/todo', {
templateUrl: 'views/todo.html',
controller: 'todoController'
});
$locationProvider.html5Mode(true);
}]);
myApp.controller('taskController', function($scope, $http) {
$http({
method: 'get',
url: 'todo'
}).then(function (response) {
$scope.about = response.data
},function (error){
console.log(error, 'can not get data.');
});
});