Skip to content

Nested roots not working using the browser`s adress bar #3517

Closed
@MiroKov

Description

@MiroKov

OS?

Windows 10.

Versions.

angular-cli: 1.0.0-beta.22-1
node: 6.9.2
os: win32 x64

Repro steps.

Created an app using ng new. Pasted und updated my code that worked before using angular-CLI so that there are no more errors.

The log given by the failure.

The app compiles fine. The error is in Chrome, when using refreshing the webpage from the browser:

Uncaught SyntaxError: Unexpected token <

response is:
grafik

Mention any other details that might be useful.

My application uses an MVC server-side routing that points to ~/index.html.
Index.html looks like this:

<title>Title</title> Loading... <script type="text/javascript" src="inline.d41d8cd98f00b204e980.bundle.js"></script>
<script type="text/javascript" src="styles.5f7f16a82a4f91544984.bundle.js"></script>
<script type="text/javascript" src="scripts.4cc5cca4ad2b0c20ad9d.bundle.js"></script>
<script type="text/javascript" src="vendor.bdd774df3cfec44bf929.bundle.js"></script>
<script type="text/javascript" src="main.b68070036956df1649d5.bundle.js"></script>

Scripts mentioned live in the same directory as index.html. The thing is, as soon as I change the directory by nesting roots
(by adding a one more '/' -> for instance when I change http://myApp/accounts to http://myApp/accounts/)
,I get the errors mentioned. Just to be explicit, routing within angular2 works good, the problem is when the request comes from browser/server.
Then I need to put something in the index.html, for instance:

<script type="text/javascript" src="**../**inline.d41d8cd98f00b204e980.bundle.js"></script> in order to get the script loaded, but naturally, the routes no longer work, and would ve a solution just for this depth of the application, when it would work. But at least it seems to point where the problem is, namely changing the directory seems to cause the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions