.controller('threadController', function($scope, $http, Posts, Comment, $location) {
Posts.getPost()
.success(function(data) {
console.log(data);
})
.error(function(data) {
console.log(data);
});
'use strict';
angular.module('postsService', [])
.factory('Posts', function($http) {
return {
getPost: function(id) {
return $http.get('/posts/' + id);
}
}
});
/LARAVEL
/**
* Display the specified resource.
* GET /posts/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$post = Post::remember(50)->find($id);
return View::make('posts/show', compact('post'));
}