-4

i am new to angularjs.can somebody help me to get this fixed.

Code

var myApp = angular.module("myApp", ['ngRoute','ngAnimate']);

myApp.controller('angCon2', function($scope, $http) {
        $http.get('https://api.myjson.com/bins/nlfmz')
                .success(function(response) {
                    $scope.lists = response;
                });
    });

Error Message

TypeError: $http.get(...).success is not a function

Error message

2

1 Answer 1

0

What if you try with

var myApp = angular.module("myApp", ['ngRoute','ngAnimate']);

myApp.controller('angCon2', function($scope, $http) {
        $http.get('https://api.myjson.com/bins/nlfmz')
                .then(function(response) {
                    $scope.lists = response;
                });
    });

So use then instead of success

Sign up to request clarification or add additional context in comments.

2 Comments

can you give me a rating? :-)
ya sure i ll do

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.