0

I have tried many way but nothing is working. In my case there will be no link of html file. I have to show content in p-dialog box from html file.

static content html file mapped with another html file which is getting used somewhere else.I have to get that file and one parameter will be dynamic in html file content.

I was trying something like this.

 <p-dialog [(visible)]="isClicked" [resizable]="true">      
    <div [innerHTML]="data/SAM3.html"></div>
</p-dialog>

Every time value will be dynamic like SAM3,SAM4 etc.

Anybody can help.

Note -> I am using Angular 5.

Sum
  • 61
  • 1
  • 11
  • Have a look at this [SO](https://stackoverflow.com/questions/46659860/angular4-load-external-html-page-in-a-div?answertab=votes#tab-top) post. – Antikhippe Jun 06 '18 at 10:49
  • Thanks, Antikhippe. – Sum Jun 06 '18 at 11:00
  • Still its giving issue "Unexpected end of input" I think because its html file and not able to load html file. my code `this.http.get('/assets/data/'+this.policyName+'.htm') .map((html:any) => this.myTemplate = html).subscribe(result => this.myTemplate =result); console.log(this.myTemplate)
    ` I tried same also in link that was also not working :(
    – Sum Jun 07 '18 at 09:41
  • error `"SyntaxError: Unexpected end of input at PolicyComponent.openPolicyDescription (webpack-internal:///./src/app/policy/component.ts:1507:9) at Object.eval [as handleEvent] (ng:///PolicyModule/PolicyComponent.ngfactory.js:16:23) at handleEvent (webpack-internal:///./node_modules/@angular/core/fesm5/core.js:11379:41) at callWithDebugContext (webpack-internal:///./node_module SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad (webpack-internal:///./node_modules/@angular/common/fesm5/http.js:1854:51)` – Sum Jun 07 '18 at 09:51

1 Answers1

0

I have resolved this issue by using window because I didnt need to perform any action so didn't use p-dialog.

    public openPolicyDesc(){
        var x = screen.width/2 - 600/2;
        var y = screen.height/2 - 350/2;
window.open('/assets/data/'+this.PolicyName+'.htm',"",'height=385,width=600,left='+x+',top='+y);       
  }
Sum
  • 61
  • 1
  • 11