dart - In AngularDart, how should I reference my templates in templateUrl so they work for both Dartium and dart2js? -


i have 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 like:

@component(     selector: 'app',     templateurl: 'templates/app.html' ) class appcomponent { ... } 

my application's index.html (in project) served /client, , project/web served /project. above works in dartium, errors pub build:

[warning _serial on project|web/main.dart input project|web/components/appcomponent.dart]: line 3, column 1 of web/components/appcomponent.dart: unable find templates/app.html @ project|templates/app.html @component( ^^^^^^^^^^^ 

and

[warning _serial]: unable find webatara|web/main.dart html_files in pubspec.yaml. 

and

[warning templatecachegenerator]: can't find asset web/web/templates/app.html. 

depending on combination of paths use in templateurl , html_files (for angular's transformer).

what, exactly, should go , how should referenced in templateurl , pubspec.yaml?

update: can rid of build errors moving templates lib directory , using templateurl: 'packages/project/templates/app.html', dartium tries load /packages/project/templates/app.html, , not /project/packages/project/templates/app.html, correct. don't see way tell base url is.

but dartium tries load /packages/project/templates/app.html, , not /project/packages/project/templates/app.html, correct. don't see way tell base url is.

i believe using angulardart 1.1.1 or 1.1.2? had same issue in our project after switching 1.1.0 1.1.2. weird behaviour added since version 1.1.1.

for reason default package root in angulardart '/packages/'. causes generation of root-relative urls. in case generates

/packages/project/templates/app.html 

instead of

packages/project/templates/app.html 

it's ok while app in root of domain. in case need add following initialization method in main.dart:

bind(resourceresolverconfig, tovalue: new resourceresolverconfig          .resolverelativeurls(true, packageroot: 'packages/')); 

this override angular's default packages root , make generate correct relative urls.

hope helps.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -