Javascript Safari的角度投掷错误

Javascript Safari的角度投掷错误,javascript,angularjs,safari,Javascript,Angularjs,Safari,在safari上,angular在调用下面的函数时抛出了一个奇怪的错误请求的非对象值的键。。它在chrome和firefox上运行良好,但在safari上则不太管用。我甚至调用了console.log来查看错误在哪里,以及$scope.id是否返回了一个值来从这个id中提取所有其他数据……测试了一些没有用的东西 app.controller('ViewOneArtist', function($scope, $http, $resource, artistesUrl, baseUrl, $sta

在safari上,angular在调用下面的函数时抛出了一个奇怪的错误请求的非对象值的键。。它在chrome和firefox上运行良好,但在safari上则不太管用。我甚至调用了console.log来查看错误在哪里,以及$scope.id是否返回了一个值来从这个id中提取所有其他数据……测试了一些没有用的东西

app.controller('ViewOneArtist', function($scope, $http, $resource, artistesUrl, baseUrl, $stateParams) {

$scope.artistesItemsResource = $resource(baseUrl + artistesUrl + $stateParams.id, {id: "@id"},
    { create : { method: "POST"}, save: { method: "PUT"}}
);

$scope.id = $stateParams.id;

console.log($scope.id);

console.log("got to here...before listOneArtiste");

$scope.listOneArtiste = function(id) {
    $scope.artistesItem = $scope.artistesItemsResource.get(id);
};

console.log("got to here...after declared listOneArtiste");

$scope.listOneArtiste($stateParams.id);

console.log("got to here...after calling listOneArtiste");

});

Console.log正在从$scope.id或$stateParams.id(例如:43)返回一个值,但是当我调用函数listOneArtist()时,它会抛出上面的错误。有什么建议吗?

在测试了几个项目后,我自己修复了它,以下是解决方案:

app.controller('ViewOneArtist', function($scope, $http, $resource, artistesUrl, baseUrl, $stateParams) {

$scope.artistesItemsResource = $resource(baseUrl + artistesUrl + $stateParams.id, {id: "@id"},
    { create : { method: "POST"}, save: { method: "PUT"}}
);

$scope.id = {id: $stateParams.id};

$scope.listOneArtiste = function(id) {

    id = this;

    $scope.artistesItem = $scope.artistesItemsResource.get(id);
};


$scope.listOneArtiste($scope.id);

});