Skip to content Skip to sidebar Skip to footer

Binding Applet Parameters With Angularjs

I need to pass a dynamic param to an applet. This is my controller: 'use strict'; angular.module('jworkApp') .controller('AppletCtrl',['$scope', function (scope) {

Solution 1:

I solved passing the entire applet declaration. In this way it works correctly.

Controller:

angular.module('jworkApp')
  .controller('AppletCtrl',['$scope', '$sce', function ($scope, $sce) {

            $scope.b64 = 'AAAA';
            $scope.applet = 
                "<APPLET>"+
                "<PARAM name=\"testo\" VALUE=\""+$scope.b64+"\" />"+
                "</APPLET>";

             $scope.getAppletCode = function() {
                  return$sce.trustAsHtml($scope.applet);
             };

  }]);

view:

<divng-bind-html="getAppletCode()"></div>

Solution 2:

A working example might be:

<!doctype html><htmlng-app = "app"><head><scriptsrc = "angular.min.js"></script></head><divng-controller = "Ctrl"><p>{{base64}}</p><APPLET><PARAMid = "applet"name="{{base64}}"value="{{base64}}" /></APPLET><divid = "debug"></div></div><script>var app = angular.module('app', []);
    app.controller('Ctrl', ['$scope', function($scope) {
        $scope.base64 = "base-sixty-four";
    }]);


    //Code to prove, that indeed, the value is what you're looking for     var applet = document.getElementById('applet');
    document.getElementById('debug').innerHTML = applet.value;
</script></html>

One thing to note: since you can't see the changes on the webpage, the way to view the result is through some kind of Development Tools, such as Chrome Dev Tools, because the value has been changed by angular after the page has been loaded. This means, that simply viewing the source will not show desired results.

Post a Comment for "Binding Applet Parameters With Angularjs"