How to set values to dynamically created variables in the view

629 views Asked by At

I'm banging my head toward the wall for this :

I want to set the value of dynamically generated view variables from controller In my view template:

<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>

In my controller:

function :

    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
    }

    });

Explanation : I want to insert a iFrame in to individual div element.

Any one has any idea how to do this ?

0

There are 0 answers