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

1

I'm having trouble loading the controller data into Angular. I do not understand, I followed the explanation step by step and I 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'm passing through Api Web is bringing the correction data via Json, but running the application already shows the error in the description.

What's happening? Could someone explain me?

    
asked by anonymous 08.10.2015 / 16:12

1 answer

0

This error does not have to do with MVC, see the detail of the error and will see which module is not being injected into the angle.

Try changing 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.";
        });
}]);
    
09.10.2015 / 17:56