diff --git a/modules/angular2/src/transform/directive_processor/visitors.dart b/modules/angular2/src/transform/directive_processor/visitors.dart
index 3ac58e8699..fe4b245581 100644
--- a/modules/angular2/src/transform/directive_processor/visitors.dart
+++ b/modules/angular2/src/transform/directive_processor/visitors.dart
@@ -269,6 +269,11 @@ class AnnotationsTransformVisitor extends ToSourceVisitor {
writer.print("template: r'''");
writer.asyncPrint(_readOrEmptyString(url));
writer.print("'''");
+
+ // We keep the templateUrl in case the body of the template includes
+ // relative urls that might be inlined later on (e.g. @import
+ // directives or url() css values in style tags).
+ writer.print(", templateUrl: r'$url'");
return null;
} else {
logger.warning('template url is not a String $url');
diff --git a/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart b/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart
index c548bb2c53..1be216a8ca 100644
--- a/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart
+++ b/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart
@@ -122,7 +122,7 @@ class _CodegenState {
localNames.map((name) => '_${name}_pipe').toList();
void _writeToBuf(StringBuffer buf) {
- buf.write('''
+ buf.write('''\n
class $_changeDetectorTypeName extends $_BASE_CLASS {
final dynamic $_DISPATCHER_ACCESSOR;
$_GEN_PREFIX.PipeRegistry $_PIPE_REGISTRY_ACCESSOR;
diff --git a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart
index abe87351b7..86deb5bc35 100644
--- a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart.ng_deps.dart;
+library examples.src.hello_world.absolute_url_expression_files.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
@@ -16,6 +16,7 @@ void initReflector(reflector) {
const Component(selector: 'hello-app'),
const View(
template: r'''{{greeting}}''',
+ templateUrl: r'package:other_package/template.html',
styles: const [r'''.greeting { .color: blue; }''',])
]
});
diff --git a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/hello.dart b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/hello.dart
index 6980e925c3..ed490b8b87 100644
--- a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/hello.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart;
+library examples.src.hello_world.absolute_url_expression_files;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/directive_processor/all_tests.dart b/modules/angular2/test/transform/directive_processor/all_tests.dart
index 347705cf81..b279b03d10 100644
--- a/modules/angular2/test/transform/directive_processor/all_tests.dart
+++ b/modules/angular2/test/transform/directive_processor/all_tests.dart
@@ -124,8 +124,8 @@ void _testNgDeps(String name, String inputPath,
if (output == null) {
expect(await reader.hasInput(expectedId)).toBeFalse();
} else {
- expect(formatter.format(output)).toEqual(
- (await reader.readAsString(expectedId)).replaceAll('\r\n', '\n'));
+ var input = await reader.readAsString(expectedId);
+ expect(formatter.format(output)).toEqual(formatter.format(input));
}
if (expectedLogs != null) {
diff --git a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart
index 52e10e3aff..8f6a4690b6 100644
--- a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart
@@ -16,6 +16,7 @@ void initReflector(reflector) {
const Component(selector: 'hello-app'),
const View(
template: r'''{{greeting}}''',
+ templateUrl: r'template.html',
styles: const [
r'''.greeting { .color: blue; }''',
r'''.hello { .color: red; }''',
diff --git a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart
index fd43b3db00..892af6e68a 100644
--- a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library test.transform.directive_processor.url_expression_files.hello.ng_deps.dart;
+library test.transform.directive_processor.invalid_url_files.hello.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
@@ -14,7 +14,10 @@ void initReflector(reflector) {
'parameters': const [],
'annotations': const [
const Component(selector: 'hello-app'),
- const View(template: r'''''', styles: const [r'''''', r'''''',])
+ const View(
+ template: r'''''',
+ templateUrl: r'/bad/absolute/url.html',
+ styles: const [r'''''', r'''''',])
]
});
}
diff --git a/modules/angular2/test/transform/directive_processor/invalid_url_files/hello.dart b/modules/angular2/test/transform/directive_processor/invalid_url_files/hello.dart
index 796f2d9738..2932497410 100644
--- a/modules/angular2/test/transform/directive_processor/invalid_url_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/invalid_url_files/hello.dart
@@ -1,4 +1,4 @@
-library test.transform.directive_processor.url_expression_files.hello;
+library test.transform.directive_processor.invalid_url_files.hello;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart
index 52e10e3aff..b526731f45 100644
--- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart.ng_deps.dart;
+library examples.src.hello_world.multiple_style_urls_files.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
@@ -16,6 +16,7 @@ void initReflector(reflector) {
const Component(selector: 'hello-app'),
const View(
template: r'''{{greeting}}''',
+ templateUrl: r'template.html',
styles: const [
r'''.greeting { .color: blue; }''',
r'''.hello { .color: red; }''',
diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/hello.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/hello.dart
index 74896ce269..11ae606866 100644
--- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/hello.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart;
+library examples.src.hello_world.multiple_style_urls_files;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart
index d54d5c3ebf..756bcfb917 100644
--- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart.ng_deps.dart;
+library examples.src.hello_world.multiple_style_urls_not_inlined_files.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/hello.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/hello.dart
index 9fff519f49..97cc1d9847 100644
--- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/hello.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart;
+library examples.src.hello_world.multiple_style_urls_not_inlined_files;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart
index b877935fb0..c6a09e72c2 100644
--- a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart.ng_deps.dart;
+library examples.src.hello_world.split_url_expression_files.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
@@ -14,7 +14,7 @@ void initReflector(reflector) {
'parameters': const [],
'annotations': const [
const Component(selector: 'hello-app'),
- const View(template: r'''{{greeting}}''')
+ const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
]
});
}
diff --git a/modules/angular2/test/transform/directive_processor/split_url_expression_files/hello.dart b/modules/angular2/test/transform/directive_processor/split_url_expression_files/hello.dart
index 14790703b2..89b7f60809 100644
--- a/modules/angular2/test/transform/directive_processor/split_url_expression_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/split_url_expression_files/hello.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart;
+library examples.src.hello_world.split_url_expression_files;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart
index b877935fb0..f9cbc9e520 100644
--- a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart
+++ b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart.ng_deps.dart;
+library examples.src.hello_world.url_expression_files.ng_deps.dart;
import 'hello.dart';
import 'package:angular2/angular2.dart'
@@ -14,7 +14,7 @@ void initReflector(reflector) {
'parameters': const [],
'annotations': const [
const Component(selector: 'hello-app'),
- const View(template: r'''{{greeting}}''')
+ const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
]
});
}
diff --git a/modules/angular2/test/transform/directive_processor/url_expression_files/hello.dart b/modules/angular2/test/transform/directive_processor/url_expression_files/hello.dart
index 5471f1eb1b..2c35e6d460 100644
--- a/modules/angular2/test/transform/directive_processor/url_expression_files/hello.dart
+++ b/modules/angular2/test/transform/directive_processor/url_expression_files/hello.dart
@@ -1,4 +1,4 @@
-library examples.src.hello_world.index_common_dart;
+library examples.src.hello_world.url_expression_files;
import 'package:angular2/angular2.dart'
show bootstrap, Component, Directive, View, NgElement;
diff --git a/modules/angular2/test/transform/integration/all_tests.dart b/modules/angular2/test/transform/integration/all_tests.dart
index 9c251d260f..c9d0789db9 100644
--- a/modules/angular2/test/transform/integration/all_tests.dart
+++ b/modules/angular2/test/transform/integration/all_tests.dart
@@ -123,7 +123,8 @@ void allTests() {
});
});
testPhases(config.name, [[transform]], config.assetPathToInputPath,
- config.assetPathToExpectedOutputPath, []);
+ config.assetPathToExpectedOutputPath, [],
+ StringFormatter.noNewlinesOrSurroundingWhitespace);
}
}
diff --git a/modules/examples/pubspec.yaml b/modules/examples/pubspec.yaml
index 1c36276c12..520b7aa556 100644
--- a/modules/examples/pubspec.yaml
+++ b/modules/examples/pubspec.yaml
@@ -16,6 +16,9 @@ dependency_overrides:
path: ../angular2_material
transformers:
- angular2:
+ # The build currently fails on material files because there is not yet
+ # support for transforming cross-package urls.
+ $exclude: 'web/src/material/**'
entry_points:
- web/src/hello_world/index_common.dart
- web/src/todo/index.dart
diff --git a/modules/examples/src/todo/css/base.css b/modules/examples/src/todo/css/base.css
index 502f06cf18..6e081eee99 100644
--- a/modules/examples/src/todo/css/base.css
+++ b/modules/examples/src/todo/css/base.css
@@ -181,11 +181,13 @@ label[for='toggle-all'] {
}
#todo-list li .toggle:after {
- content: url('data:image/svg+xml;utf8,');
+ /*encoded url: 'data:image/svg+xml;charset=utf8,'*/
+ content: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22%2F%3E%3C%2Fsvg%3E');
}
#todo-list li .toggle:checked:after {
- content: url('data:image/svg+xml;utf8,');
+ /*encoded url: 'data:image/svg+xml;charset=utf8,'*/
+ content: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E');
}
#todo-list li label {