javascript - My picklist is not filling correctly (jquery-ui picklist + angularjs filling) -
(using: https://code.google.com/archive/p/jquery-ui-picklist/)
i understand should not mix both technologies, there's not angularjs picklist , implemented 1 jquery-ui.
it opening picklist in modal, using ng-repeat , not give errors , not work.
it used work on picklist using (another template).
please, can be?
angular.module('boxapp').controller("cadastrocertificado", function($scope, $http) { $scope.clientes = {}; $scope.listaempresas = []; $scope.iniciar = function() { $http.get(urlrestserver + '/cadastrocertificado').success(function(response) { $scope.clientes = response; }); }; $scope.iniciar(); /** * trabalhando o componente picklist */ $scope.clientes2 = []; $scope.atribuirum = function(index, c) { var cliente = {}; cliente.idcliente = c.idcliente; cliente.razaosocial = c.razaosocial; $scope.clientes2.push(cliente); $scope.clientes.splice(index, 1); }; $scope.limparum = function(index, c2) { $scope.clientes2.splice(index, 1); $scope.clientes.push(c2); }; /** * trecho para validar o form ao submeter. */ $scope.submitted = false; $scope.submitform = function(form, clientes2) { $scope.listaempresas = $scope.clientes2; $scope.submitted = true; if (form.$valid) { $scope.cadastracertificado(); } }; /** * requisição post (ajax) */ $scope.cadastracertificado = function() { var dados = { urlcertificado : $scope.certificadoincluiralterar.urlcertificado, strdatavalidadecertificado : $scope.certificadoincluiralterar.strdatavalidadecertificado.tostring(), senhacertificado : $scope.certificadoincluiralterar.senhacertificado, listaempresas : $scope.listaempresas }; $http.post(urlrestserver + '/cadastrocertificado/salvarcertificado', dados).then(function(response) { }, function(response) { $scope.sucesso(); }); }; $scope.sucesso = function() { $scope.closemodal(); $scope.iniciar(); }; $scope.closemodal = function() { $('#mymodal').modal('hide'); }; });
<div class="form-group"> <label class="control-label col-md-3">empresas:</label> <div class="col-md-9"> <select id="foobar" name="foobar" multiple="multiple"> <option ng-repeat="c in clientes" value="{{c.idcliente}}" ng-click="atribuirum($index, c)">{{c.razaosocial}}</option> <option selected ng-repeat="c2 in clientes2" value="{{c2.idcliente}}" ng-click="limparum($index, c2)">{{c2.razaosocial}}</option> </select> </div> </div>
well, made myself picklist , applied css classes it.
better mixing jquery angularjs, giving me headaches , errors.
Comments
Post a Comment