TaylorR
TaylorR

Reputation: 4013

Dart Angular sample

I am using IntelliJ IDEA to develop a Dart/Angular app, from IDEA's new project wizard.

After compiling OK, I tried to load it both from browser (run as a local file) and from Web access (served by Apache2).

But the page (index.html) just show plain "Loading...", no further display etc.

Can anyone give some hint on this?

Upvotes: 1

Views: 242

Answers (1)

TaylorR
TaylorR

Reputation: 4013

I think I have solved this problem.

Noticed there are a few lines in the output index.html in the <script>...</script> section:

<script>
    // WARNING: DO NOT set the <base href> like this in production!
    // Details: https://webdev.dartlang.org/angular/guide/router
    (function () {
        // App being served out of web folder (like WebStorm does)?
        var match = document.location.pathname.match(/^\/[_\w]+\/web\//);
        var href = match ? match[0] : '/';
        document.write('<base href="' + href + '" />');
    }());
</script>

Just comment out everything generated by the compiler.

One thing to notice is that: In IDEA I have checked to compile to "Production" and in command line the pub help build tells me the default mode is release, so I really wonder why these lines are not taken out when compiling to production release?

Upvotes: 1

Related Questions