Routing with AngularJS and Slim PHP

后端 未结 2 1888
情书的邮戳
情书的邮戳 2021-01-06 13:46

I have been working with AngularJS and I am trying to connect my application to it.

So far I have used Slim PHP and can get all records from my MySql database but I

2条回答
  •  长情又很酷
    2021-01-06 14:16

    Hey everyone thanks for the input I was able to diagnose the issue!

    using the network tab on chrome developer tools I saw that my code was sending the word "id" and not a variable.

    I have now modified my controller by simply adding my route parameters onto the resource string. Seems to be working great now! Thank you everyone

    app.js

    app.controller('viewRequestController', function($scope, $location, $route, $routeParams, $resource) {
            $scope.message = 'Pow!';
            $scope.header = 'View Change Request';
    
            var request_Id = $routeParams.id;
            var Request = $resource(('http://pdgrosit02v/changeRequest/app/api/requests/'+ request_Id));
    
            $scope.request = Request.get();
    });
    

提交回复
热议问题