Uncaught Error: [$injector:modulerr] - Asp.Net MVC

Asked

Viewed 174 times

1

I’m having trouble uploading data from controller in Angular. I’m not understanding, I followed step by step the explanation and mine gave this error.

var app = angular.module('app', []);

app.controller('clienteController', ['$scope', '$http', clienteController]);

function clienteController($scope, $http) {
    $http.get("http://localhost:26633/api/ClientesWebApi/GetCliente")
    .success(function (data) { $scope.listaclientes = data; })
    .error(function () { $scope.erro = "Não foi possivel carregar a listagem de clientes."; });
}

The link I am passing via Web Api is bringing the correct data via Json, but when running the application already shows the error in the description.

What is going on? Could someone explain to me?

1 answer

0

This error has nothing to do with MVC, see the detail of the error and you will see which module is not being injected at the angle.

Try to change your code to something like:

var app = angular.module("app", []);

app.controller("clienteController", ["$scope", "$http", function ($scope, $http) {
    $http.get("http://localhost:26633/api/ClientesWebApi/GetCliente")
        .success(function (data) {
            $scope.listaclientes = data;
        })
        .error(function () {
            $scope.erro = "Não foi possivel carregar a listagem de clientes.";
        });
}]);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.