Bill,
When I run you app, I get this compile error:
"app/app.component.ts(5,2): error TS2345: Argument of type '{ selector:
string; moduleId: string; restrict: string; templateUrl: string; }' is not
assignable to parameter of type 'Component'.
*Object literal may only specify known properties, and 'restrict' does
not exist in type 'Component'*."
Remove the "restrict: "E"," as it's not allowed in the Component
And now it runs and loads the templateURL fine.
HTH,
Kenny
On Friday, November 11, 2016 at 3:48:25 AM UTC-6, Bill Wu wrote:
>
> I am having some trouble getting templateUrl to work properly, but
> substituting templateUrl with the following works fine:
>
> template: `<h1>abc</h1>`
>
> gives:
>
> abc
>
> but using templateUrl, this is the output:
>
> ��<
>
> app.component.ts
>
> import { Component } from '@angular/core';
>
>
> @Component({
> restrict: "E",
> moduleId: module.id,
> selector: 'my-app',
> templateUrl: "app.component.html",
> })
> export class AppComponent {
> title = 'Tour of Heroes';
> path = 'app.component.html';
> }
>
> app.component.html
>
> <h1>abc</h1>
>
> index.html
>
> <!DOCTYPE html>
> <html>
> <head>
> <title>Angular QuickStart</title>
> <meta charset="UTF-8">
> <meta name="viewport" content="width=device-width, initial-scale=1">
> <link rel="stylesheet" href="styles.css">
> <!-- 1. Load libraries -->
> <!-- Polyfill(s) for older browsers -->
> <script src="node_modules/core-js/client/shim.min.js"></script>
> <script src="node_modules/zone.js/dist/zone.js"></script>
> <script src="node_modules/reflect-metadata/Reflect.js"></script>
> <script src="node_modules/systemjs/dist/system.src.js"></script>
> <!-- 2. Configure SystemJS -->
> <script src="systemjs.config.js"></script>
> <script>
> System.import('app').catch(function(err){ console.error(err); });
> </script>
> <base href="/">
> </head>
> <!-- 3. Display the application -->
> <body>
> <my-app>Loading...</my-app>
> </body>
> </html>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.