为此,我将头撞到墙上:
我想从控制器中设置动态生成的视图变量的值 在我的视图模板中:
<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
}
});
说明:我想在单个 div 元素中插入一个 iFrame。
任何人都知道如何做到这一点?