如何在视图中为动态创建的变量设置值

时间:2015-06-18 08:03:20

标签: angularjs ng-bind-html

为此,我正朝着墙壁敲打:

我想设置从控制器动态生成的视图变量的值 在我的视图模板中:

<div ng-repeat="(key,value) in educations" >
    <p ng-click="loadEducation(value)">Dynamically add html to the below <div> </p>
    <div ng-bind-html="eduiframe_value[ID]"></div>
</div>

在我的控制器中:

功能:

    module.controller('listeducations',function($scope,$http,$rootScope,$cookies,ServiceEducation){
    /*
    service below will set the view variable educations
    each object contains the following :
    $$hashKey: "object:132"
    ID: "440"
    title: "HIPPA_SERVER_CONFIGURATION_1.pdf"
path : "http://stackoverflow.com/"
    */
     ServiceEducation.getEducations($scope);

     /*Open a education item in the iFrame*/
    $scope.loadEducation = function(obj){
        var p = 'eduiframe_'+obj.ID;
        $scope.p = '<iframe src='+obj.path+' >'; //but this is not working
    }

    });

说明:我想将iFrame插入到单个div元素中。

任何人都知道如何做到这一点?

0 个答案:

没有答案