结合applet参数与angularJS [英] Binding applet parameters with angularJS

查看:149
本文介绍了结合applet参数与angularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个动态的参数传递给小程序。

I need to pass a dynamic param to an applet.

这是我的控制器:

'use strict';

    angular.module('jworkApp')
      .controller('AppletCtrl',['$scope', function (scope) {
              scope.base64 = "abcd";
}]);

这是我的看法,参数Base64是在控制器中定义为ABCD

This is my view, the parameter base64 is defined in the controller as "abcd"

<p>{{base64}}</p>
<APPLET>
  <PARAM name="text" value={{base64}} />
</APPLET>

当我跑我的网页我看到在p标签字符串ABCD,但小程序参数的值,它只是{{}的base64}。

When I run my page I see in the p tag the string 'abcd' , but the applet param's value it's simply "{{base64}}".

我怎么能解决呢?

推荐答案

我解决了通过整个小程序申报。通过这种方式,可以正常工作。

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

控制器:

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);
             };

  }]);

查看:

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

这篇关于结合applet参数与angularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆