Error passing request attribute to an angular directive

1

I have to pass an array of objects to an angular directive, but I have the error below. How do I solve it?

angular.js:12330 Error: [$parse:ueoe] Unexpected end of expression: [{
http://errors.angularjs.org/1.4.3/$parse/ueoe?p0=%5B%7B
    at angular.js:68
    at Object.AST.peekToken (angular.js:12900)
    at Object.AST.object (angular.js:12856)
    at Object.AST.primary (angular.js:12776)
    at Object.AST.unary (angular.js:12764)
    at Object.AST.multiplicative (angular.js:12751)
    at Object.AST.additive (angular.js:12742)
    at Object.AST.relational (angular.js:12733)
    at Object.AST.equality (angular.js:12724)
    at Object.AST.logicalAND (angular.js:12716)

Servlet

@Controller
@RequestMapping(value = "/fornecedor")
public class FornecedorController {

    @RequestMapping(value = "/novo", method = RequestMethod.GET)
    public String novo(HttpServletRequest request) {
        try {
            JSONArray listaEstadoJO = JsonUtil.getList("http://localhost:8080/marcenaria-ws/estado/listar");
            request.setAttribute("listaEstado", listaEstadoJO);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "fornecedor/novo";

    }
}

novo.jsp

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="defaultTemplate">
    <tiles:putAttribute name="body">
        <manter-fornecedor lista-estado="${listaEstado}"></manter-fornecedor>
    </tiles:putAttribute>
</tiles:insertDefinition>

directive

"use strict";

angular.module("fornecedor")
.directive('manterFornecedor', function () {
    return {
        restrict: 'E',
        templateUrl: '../resources/js/angular/directive/fornecedor/manter-fornecedor.html',
        scope: {
            msgSucesso: '=',
            msgError: '=',
            msgInfo: '=',
            listaEstado: '='
        },
        controller: "manterFornecedorCtrl",
        controllerAs: "mFornCtrl"
    }
});

angular.module("fornecedor")
.controller("manterFornecedorCtrl", ["$scope", "$http", "$timeout", "request", "tools", "fornServ", function ($scope, $http, $timeout, request, tools, fornServ) {

    var self = this;
    console.log("esse mesmo "+$scope.listaEstado);
    $scope.loadingAjax = false;
    this.limpar = function () {
        fornServ.limpar($scope);
        fornServ.limparMensagem($scope);
    };

    this.salvar = function () {
        $scope.loadingAjax = true;
        fornServ.limparMensagem($scope);
        console.log($scope.fornecedor);
        $scope.msgError = fornServ.validar($scope);

        if ($scope.msgError == 0) {
            fornServ.salvar($scope,request)
            .then(function(){
                $scope.msgSucesso = "Fornecedor inserido com sucesso.";
                fornServ.limpar($scope);
            });
        }
        $scope.loadingAjax = false;
    };
}]);
    
asked by anonymous 23.03.2016 / 18:20

0 answers