How to do ng-model in this case, where I have only one input?

Asked

Viewed 52 times

1

I have this code in .pug:

div(class="box-group" ng-controller="filter")

    div(class="panel box box-primary col-sm-12")
        div(style="text-align:center")
            h4 Filtro    
        div(class="form-group col-sm-12")
            label Selecionar Banco:
            select(class="form-control")
        div(class="col-sm-12")
            br
            div(id="treeview")
              script#item-template(type='text/x-kendo-template').
                # if (data.item.showCombo) { #
                #= data.item.text #
                <input text ignoreCss="True" k-ng-model=data> 
                # } else { #
                #= data.item.text #
                # } #

        div(class="modal-footer")
            button(type="button" class="btn btn-primary" ng-click="confirmar()") Confirmar

And this on .js I need to save what’s in the objects, using ng-model. How to do it, since I only have one input?

angular.module('app').controller(
    'filter',
    ['$scope', '$ftHttp', 'ngToast', '$location', '$filter',
        function ($scope, $ftHttp, ngToast, $location, $filter) {
            $(function () {
                $("#treeview").kendoTreeView({
                    dataSource: {
                        data: [{
                            text: "ID",
                            showCombo: false,
                            checked: false,
                        }, {
                            text: "Hash",
                            showCombo: true,
                            checked: false,
                            modalConfigName: "hash"
                        }, {
                            text: "Endereço",
                            showCombo: false,
                            checked: false,
                            items: [{
                                text: "Hash",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Tipo De Logradouro",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Nome Do Logradouro",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Número Do Endereço",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Complemento",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Bairro",
                                showCombo: true,
                                checked: false
                            }
                            ]
                        }, {
                            text: "Telefones",
                            showCombo: false,
                            checked: false,
                            items: [{
                                text: "Hash",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "DDD",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Número Do Telefone",
                                showCombo: true,
                                checked: false
                            }
                            ]
                        }, {
                            text: "Dados",
                            showCombo: false,
                            checked: false,
                            items: [{
                                text: "Hash",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Tipo De Pessoa",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Número Do Contrato Completo ",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Codigo Do Sistema De Origem",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Codigo Da Operação",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Codigo Da Agencia",
                                showCombo: true,
                                checked: false
                            }
                            ]
                        }, {
                            text: "Acionamentos",
                            showCombo: false,
                            checked: false,
                            items: [{
                                text: "Hash",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "CPF_CNPJ",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Número Do Contrato Completo",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Renavam",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Chassi",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Placa",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Categoria",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Marca",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Modelo",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Ano",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Cor",
                                showCombo: true,
                                checked: false
                            }, {
                                text: "Brancos",
                                showCombo: true,
                                checked: false
                            }
                            ]
                        }
                        ]
                    },
                    checkboxes: false,
                    template: kendo.template($("#item-template").html())
                });
            });
            $scope.confirmar = function () {
                if ($scope.data) {
                    $ftHttp.post('/proxy/form/insert-wizard', $scope.dataSource)
                        .then(function (response) {
                            $scope.data = response.data.msgSaida;
                        }, function (err) {
                            ngToast.danger('Erro ao tentar enviar informações para cadastro de formulário.\nDetalhes : ' + err.data);
                        }
                        );
                }
            };
        }]);
No answers

Browser other questions tagged

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