1

I have a iframe which return some json string. I have to use that json to construct a table.

<iframe id="idHiddenFrame" name="HiddenFrame" src="/PTO/PlattsIncident.nsf/frmBlank?ReadForm" width="0px" height="0px" onload="addAttachment()"></iframe>

Below is the javascript code using angular js

$window.addAttachment=function(){
        if($.parseJSON(frames["HiddenFrame"].document.getElementsByTagName("body")[0].innerHTML)!=null){
            $scope.attachments.push($.parseJSON(frames["HiddenFrame"].document.getElementsByTagName("body")[0].innerHTML));
            console.log($scope.attachments);
        }
    }

console.log is printing the correct value as below

0: Object
attachName: "Root Cause Analysis - Stringer SSF - 02072013.doc"
docID: "290005B6A4CFB9FD85257BBB002433A8"

But below code using ng-repeat is not working

<ul class="list-group">
    <li class="list-group-item" ng-repeat="attachment in attachments">{{attachment.attachName}}</li>
</ul>

Any help is much appreciated.

1 Answer 1

2

Can you try below code and used $scope.$apply():

$window.addAttachment=function(){
        if($.parseJSON(frames["HiddenFrame"].document.getElementsByTagName("body")[0].innerHTML)!=null){
            $scope.attachments.push($.parseJSON(frames["HiddenFrame"].document.getElementsByTagName("body")[0].innerHTML));
            console.log($scope.attachments);
           $scope.$apply();
        }
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.