-
Notifications
You must be signed in to change notification settings - Fork 248
feat(relative uris): Allow relative URIs for templateUrls and cssUrls #1238
Conversation
*/ | ||
void resolveDom(Node root, [Uri originalBase]) { | ||
if (originalBase == null) { | ||
// Use baseUrl when dartbug.com/18196 is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like it has been fixed back in April
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed that, thanks!
Does this PR supersede #901 ? |
@vicb Yes it does. It was originally forked from Chris' work. We finally got it to an engineer that had enough time to rebase it and be responsible for the feature. |
I added the test you mentioned, and fixed up those little things. I squashed the commit into the original one in the interest of keeping this nice and clean, so if it's hard to see the changes from the original commit let me know and I'll separate them again. Thanks! |
Thanks again @dsalsbury for taking this over and getting it into shape! One thing that should be noted in the release notes is that this is a breaking change for anyone using |
@cbracken "package:.." is not a concept that is in Angular at all so we shouldn't have to mark it as a breaking change. It is something we use internally only. It will be a transition that we have to deal with. |
fyi, for those observing, we're still actively working on this one. |
String resolve(String uri, Type type) { | ||
var typeMirror = reflectType(type); | ||
LibraryMirror lib = typeMirror.owner; | ||
if (typeMirror == Uri.base) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var libUri = lib.uri;
if (libUri begins with Uri.base) {
libUri = libUri.path;
}
Some clients do not generate static factories for test code, and instead directly depend on TestBed constructor. This commit adds a new constructor is basically the injector factory method, requiring only injector vs a full set of parameters. Once clients have been moved to use fromInjector method (or even better a transformer run for test code), we can change the constructor dependencies in a non-breaking way. Closes dart-archive#1271
Angular's pubspec for intl spans versions with breaking changes. For Angular, a change in date formatting would be a breaking change but changes do to CLDR updates are not breaking changes. This commit updates a test to swap out a locale with a CLDR update to one that wasn't updated to enable it to pass across the CLDR breaking change. Closes dart-archive#1203
in _recordAdd(), previous could never be null as the list is never empty (it has at least a marker). in _recordRemove(), when the list is composed of a single record, it must be the record we're trying to remove (and we assert that). Closes dart-archive#1256
Fixes dart-archive#1128 Closes dart-archive#1132 The insertBefore argument is never used in the current code
(see the v0.13.0 tag for the exact history of this version)
Closes dart-archive#922 Closes dart-archive#1172 Closes dart-archive#1289 Closes dart-archive#1291
This reverts commit 1eebe45. Travis fails: https://travis-ci.org/angular/angular.dart/builds/31741920
Example: When defining a component called 'foo' in file '/myproject/has/many/folders/foo.dart', prior to the change you would do so thusly: @component( selector: 'foo', templateUrl: '/myproject/has/many/folders/foo.html', cssUrl: '/myproject/has/many/folders/foo.css' ) The above is still valid, but now can also be defined rather more succinctly as: @component( selector: 'foo', templateUrl: 'foo.html', cssUrl: 'foo.css' ) A full table of what URLs will be changed/unchanged is below: You Say: Transformer replies: 'packages/foo/bar.html' 'packages/foo/bar.html' 'foo.html' 'packages/foo/bar.html' './foo.html' 'packages/foo/bar.html' '/foo.html' '/foo.html' 'http://google.com/foo.html' 'http://google.com/foo.html' *Note that as shown any absolute paths you define will not be bothered by the transformer, so if you have a templateUrl living at <root>/foo.html, you can still reach it with '/foo.html'! This feature is defaulted to an "off" state through the addition of the ResourceResolverConfig class. To turn the feature on, bind a new ResourceResolverConfig in your module: module.bind(ResourceResolverConfig, toValue: new ResourceResolverConfig(useRelativeUrls: true));
No description provided.