$ http.get ('{{path ("error in the path

0

Hi, I'm new using AngularJs and I can not pass variables to php Silex, if you catch them but when I do the function, the route does not take them

Launches this error:

  

link

and when I do it directly with an action

  

link

but I do not want it that way because I have it in a json

function buscar() {
        $http.get('{{ path("admin.filtro") }}', { params: vm.filtro })
            .success(function(data) {
                if (data.status == "success") {
                    vm.registros = data.registros;
                }
            })
            .error(function(err) {
                console.log(err);
            });
    }
    
asked by Joel Hernandez Contreras 19.09.2017 в 08:33
source

1 answer

1
 $http.get('{{ path("admin.filtro") }}', { params: vm.filtro })

what you're putting {{path ("admin.filtro")}} is used in the views so that AngularJs when it shows the file change everything inside {{ }} and replace it with the corresponding value that in this case is $ scope.path = (you have in the controller)

It should be something like:     $ http.get (vm.path ("admin.filter"), {params: vm.filter})

or if path is a factory / service

$http.get(path("admin.filtro") , { params: vm.filtro })
    
answered by 19.09.2017 / 09:18
source