Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

306
Visualizações
$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 Respostas
Responde à pergunta

0

Success is deprecated. Use then.

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

}, function error(err) {

})
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda