In AngularDart, how should I refer to my templates in templateUrl so that they work for both Dartium and dart2js?

I currently have this directory layout:

project
    web
        app.html
        main.dart
        templates
            app.html
            alerts.html
            menu.html
        components
            AppComponent.dart
            AlertsComponent.dart
            MenuComponent.dart
        resources
            css
                bootstrap.css

My components look like this:

@Component(
    selector: 'app',
    templateUrl: 'templates/app.html'
)
class AppComponent { ... }

My index.html application (in another project) comes from /client, and project/webfrom /project. The above works in Dartium, but I get errors from pub build:

[Warning from _Serial on project|web/main.dart with input project|web/components/AppComponent.dart]:
line 3, column 1 of web/components/AppComponent.dart: Unable to find templates/app.html at project|templates/app.html
@Component(
^^^^^^^^^^^

and

[Warning from _Serial]:
Unable to find webatara|web/main.dart from html_files in pubspec.yaml.

and

[Warning from TemplateCacheGenerator]:
Can't find asset web/web/templates/app.html.

depending on which combination of paths I use in templateUrland html_files(for an Angular transformer).

What exactly should go, where and how should I refer to templateUrland pubspec.yaml?

: , lib templateUrl: 'packages/project/templates/app.html', Dartium /packages/project/templates/app.html, /project/packages/project/templates/app.html, . , URL.

+4
1

/packages/project/templates/app.html, /project/packages/project/templates/app.html, . , URL.

, angulardart 1.1.1 1.1.2? 1.1.0 1.1.2. , 1.1.1.

- AngularDart '/packages/'. URL-.

/packages/project/templates/app.html

packages/project/templates/app.html

, . main.dart:

bind(ResourceResolverConfig, toValue: new ResourceResolverConfig
         .resolveRelativeUrls(true, packageRoot: 'packages/'));

angular URL-.

, .

+3

All Articles