0
$http.get('data/stock.json').success(function(data){
    $scope.stock = data;
})

and i also tried this

$http.get('data/stock.json').then(function(data){
    $scope.stock = data;
})

my Data is in stock.json file no problem in HTML which is working and i m working on angular 1.6 version

1 Answer 1

2

In Angular 1.6, The $http legacy promise methods success and error have been deprecated. So you have to use the standard then method instead. So change your code like this:

$http.get('data/stock.json').then(function(data){
    $scope.stock = data.data;
})
Sign up to request clarification or add additional context in comments.

1 Comment

Its mentioned in the documentation of $http docs.angularjs.org/api/ng/service/$http

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.