Monday, March 20, 2017

Using Laravel 5.4 route in AngularJS $http service

I'm using Laravel 5.4 and AngularJS. I have this function :

$scope.allPosts = function() {
        $http.get("/posts")
            .then(function(){
            }, function(error){
            });
};

How can I avoid using hardcoded "/posts" and instead using a Laravel route there ?

Thank you.



via dwix

Advertisement