Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

305
Views
$http.get(...).success is not a function

So I'm working on a small app with angular 1 with file uploading and I found out that there were changes that I wasn't aware of as the way coding https in a controller is different now. As the old way now causes http.get.success is not a function. I need help understanding what changes from 1.4 angular 1 to the current version that I have to do now with my controllers so my data from my rest API show up on my HTML. As I'm getting $http.get(..).success is not a function error now.

  gallerycontroller

       var galleryCtrl = angular.module('galleryCtrl', []);
galleryCtrl.controller('galleryController', function($scope, $http) {
    $scope.superheroes= [];
    //Retrieve all the superheroes to show the gallery
    $http({
        method: 'GET',
        url: '/superhero'
    })
        .success(function (data, status, headers, config) {
            console.log(data);
        })
        .error(function (data, status, headers, config) {
            console.log(data)
        })
});

gallery.html 
    <!-- view the gallery of all the superheroes in the db -->
    <div class="row">
        <div ng-repeat="superhero in superheroes">
            <div class="col-md-4 col-xs-6  col-sm-offset-0">
                <div class="thumbnail">
                    <img ng-src="{{superhero.picture.url | fpConvert: {filter:'sharpen', w:300, h:150} }}" />
                    <div class="caption text-center">
                        <h3>{{superhero.name}}</h3>
                        <p><label>Super powers: </label> {{superhero.superPowers}}</p>
                        <div class="text-right"><a ng-href="/#/detail/{{superhero._id}}" class="btn btn-danger" role="button">View</a> </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Success is deprecated. Use then.

$http.get().then(function success(result){

}, function error(err) {

})
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!