Pass angular array on json to mvc controller

1

I have this function that generates an array, I need to pass to the mvc controller through JSON, but it is not passing, it follows what I'm doing:

  var app = angular.module('myApp', []);
    app.controller('myCtrl', function ($scope) {
        $scope.total = "00:01";
        $scope.Tolerancia = 0;
        $scope.items = [];

        $scope.totalProposta = function () {
            $scope.soma = 1 + $scope.Tolerancia;
            $scope.total = "00:" + $scope.soma;
        };

        $scope.addItem = function (user) {
            $scope.items.push({
                de: $scope.total,
                ate: user.ate,
                tipo: user.tipo,
                valor: user.valor,

            });
            $scope.total = ''
            $scope.total = user.ate;
            user.ate = '';
            user.tipo = '';
            user.valor = '';
        };

        $scope.removeItem = function (index) {
            $scope.items.splice(index, 1);
        }

        $scope.gravaItem = function () {
            $.ajax({
                type: 'GET',
                url: '/TaxaPreco/SalvarItens',
                dataType: 'json',
                contentType: 'application/json; charset=utf-8',
                data: JSON.stringify($scope.items),
                success: function (result) {
                    console.log('Data received: ');
                    console.log(result);
                }
            })
        };

    });

I think the problem lies in this line:

data: JSON.stringify($scope.items),

But in any case it does not pass the value, how can I proceed?

    
asked by anonymous 06.06.2018 / 16:47

0 answers