mvc url.content in typescript

Topics: General
Dec 12, 2013 at 5:50 PM
Hi all,
I'm moving some scripts from an mvc view to a typescript file.
All is going fine but I have a question: normally inside the view I have
        url: "~/H3g/PrezzoTerminale/" + promoId,
and the ~ is parsed by the razor engine, but if I move in the typescript file, and in the external js
file that typescript generates, how can be sure that the address is always translated?
Just removing the ~ usually creates me problems if i move this in a subdirectory.

Dec 13, 2013 at 3:40 PM
The tilde (~) is an ASP.Net MVC convention. JavaScript (and of course TypeScript) has no conception of that.

You may want to try StackOverflow with the question "How do I preserve relative URLs when moving inline JavaScript from a razor view".