Angular.js and Java Applet

前端 未结 1 1986
陌清茗
陌清茗 2020-12-17 07:20

I\'m trying to call a java function via applet using Angular.js with no success. I\'m not even getting the Applet loaded (java console is not starting when I load the app).

1条回答
  •  不知归路
    2020-12-17 07:43

    We got it with the code below:

    index.html

    
    

    signController.js

    (function() {
        'use strict';
    
        angular
            .module('app')
            .controller('signController', signController);
    
        signController.$inject = ['$rootScope', '$scope','listFactory', 'infoService'];
    
        /* @ngInject */
        function signController($rootScope, $scope, listFactory, infoService) {
            var vm = this;
            var token = $rootScope.token;
            $scope.name = infoService.getName;
    
            ////////////////
    
            $scope.signFile = function () {
                var fileId = infoService.getId();
                var Id = fileId.toString();
                var res = document.getElementById("cdigApplet").signFile(Id, '', token);            
    
                var json = JSON.parse(res);
                if (json.success === true)
                {
                    alert("Documento assinado com sucesso! Clique em 'Abrir' para ver a assinatura.");
                    $('#sign').modal('hide');
                }
                else
                {
                    alert("Documento não assinado!\n" + json.message);
                    $('#sign').modal('hide');
                }
            };
        }
    })();
    

    0 讨论(0)
提交回复
热议问题