N
N
naneri2014-08-15 12:55:30
Angular
naneri, 2014-08-15 12:55:30

How to handle GET request parameters from AngularJS in Laravel?

At this time, I am writing a program that searches for all tasks for a specific goal (in general, there is a goal with a certain Id, and in order to complete it, all its tasks must be completed).
Upon completion of the download, the goal page sends a GET request to the server to pull out all the tasks, but I can’t figure out where to write down the Id of the goal to send

var goal_id = $scope.goal_id;
    console.log($scope.goal_id);
    /**
     * Gets all tasks from the server
     * 
     * @returns {object}
     */
    function getall() {
        $http.get('http://finalblog.local/task/index/' + $scope.goal_id).success(function(data) {
            console.log($scope.goal_id);
            console.log(data);
            $scope.tasks = data;
        });
    }

In the first call to console.log() - $scope.goal_id gives undefined, and in the second it gives the correct value.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pr0kazn1k, 2015-03-03
@pr0kazn1k

Angular
Laravel
Input::get('id');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question