3

having some trouble altering a url when the filename will change every time.

this is the url i am returning from api. the pdf name will be different evertime

C:/Users/rsanchez/Source/completePdfs/PdfSharpResult-6-23-2015 2-13 PM.pdf

I need to change it to this

ViewerJS/#../completePdfs/PdfSharpResult-6-23-2015 2-13 PM.pdf

what I am trying so far

  var fileURL = result.FileName;
                               fileURL.replace('C:/Users/rsanchez/Source/completePdfs/', 'ViewerJS/#../completePdfs/')
  $scope.returnedPdf = fileURL;
  console.log(fileURL)

1 Answer 1

4

You are doing it alright. Just assign the update value back to fileURL

fileURL = fileURL.replace('C:/Users/rsanchez/Source/completePdfs/', 'ViewerJS/#../completePdfs/')
Sign up to request clarification or add additional context in comments.

2 Comments

Can probably skip that and go straight to $scope.returnedPdf = fileURL.replace('C:/Users/rsanchez/Source/completePdfs/', 'ViewerJS/#../completePdfs/');
@PatrickMurphy - yes this refinements can always be done. Thanks for the update.

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.