Using stateparams is not returning the json to display in detail [closed]

1

Well, I have the following problem:

I have a json file, and I'm calling it like this:

$http.get("../templates/teste.json").success(function (response) {

    $scope.x = response;

});

On my route, it looks like this:

.state('app.detalhe', {
    url: '/produtos/:ProdutoId',
    views: {
        'menuContent': {
            templateUrl: 'templates/detalhe.html',
            controller: 'ProdutosCtrl'
        }
    }
})

On my controller, it looks like this:

$scope.produtoSingle = function () {

     x[$stateParams.produtoId]; }

}

The url is correct:

And he just does not return any of the detail, could anyone tell me what's going on?

    
asked by anonymous 20.09.2015 / 02:01

1 answer

0

See my answer at: link

Try:

$http.get("../templates/teste.json").success(function (response) {

    $scope.x = response;
    if (!$scope.$$phase) $scope.$apply();
});
    
24.11.2015 / 14:20