title: Navigating to a DataURI in angular2 through a function
body: <p>I am trying to call a function that will trigger a file download in angular2. This data is stored in memory of the angular2 app (not on the server.  Based on what I've read i need to create a data uri
  Here is my code that does this.</p>
  
  <p><code>downloadData() {
      let data="bacon,goodness";
      let uri = this._sanitizer.bypassSecurityTrustUrl("data:text/csv;charset=UTF-8," + encodeURIComponent(data));
      this.download=uri;
      window.location.href = uri;
    }</code> </p>
  
  <p>My issue is that I cannot run the command </p>
  
  <p>'window.location.href=uri'</p>
  
  <p>It gives the error 
  'SafeUrl' is not assignable to string
  Is there another way to navigate to SafeUrl from inside a function</p>