Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

308
Vistas
$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 Respuestas
Responde la pregunta

0

Success is deprecated. Use then.

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

}, function error(err) {

})
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda