changingThisBreaksApplicationSecurity angular2

Iam trying to load a pdf document in an tag in angular2 Dynamically, and when i am tring to change the URL iths throwing an error saying

SafeResourceUrlImplchangingThisBreaksApplicationSecurity: "localhost:8002/pdf.pdf"proto: SafeValueImplconstructor: SafeResourceUrlImpl()getTypeName: ()proto: Object

localhost:8002/pdf.pdf Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME

Heres how iam setting the URL, This method will be called when i need to show the component

public show(): void {
        this.visible = true;
        this.visibleAnimate = true;
        console.log(this.src)
        this.DocURL = this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
        console.log(this.DocURL);
    }


 constructor(private sanitizer: DomSanitizer) {
        this.visible = false;
        this.visibleAnimate = false;

        this.DocURL = this.sanitizer.bypassSecurityTrustResourceUrl(window.location.host + "/pdf.pdf");
    }

Heres the HTML Part

  <div style=" height:650;width:870">
          <object width="870" height="650" type="application/pdf" [data]="DocURL" id="doc" #doc>
            <p>Not able to display the document</p>
           </object>
       <div style="display:none">
           <iframe id="fred" #fred style="border:1px solid #666CCC" title="PDF in an i-Frame" [src]="DocURL" frameborder="1" scrolling="auto" height="1100" width="850" ></iframe>
       </div>
  </div>

The URL iam supplying will be dynamic


ANSWERS:


Your URL does not have a protocol. Try the following:

this.DocURL = this.sanitizer.bypassSecurityTrustResourceUrl(window.location.protocol + '//' + window.location.host + "/pdf.pdf");


 MORE:


 ? Issue with ng-bind-html
 ? Convert HTML in JSON file with Angular
 ? Passing value with Razor Engine one a SPA
 ? Are additional settings required for AngularJS routing to work in asp.net Web Application (Not MVC)?
 ? Bootstrap.navbar + Angular.routeProvider not working also not giving any error in chrome
 ? Angular $location search does not work always
 ? Can we pass two parameters in $routeProvider.when() function in angular js
 ? Angular 1.x/2 Hybrid, karma tests not bootstrapping ng1 app
 ? Node server to intercept all request from angular (http) to java spring backend
 ? Angular change url without executing routeprovider