Skip to content

Using backticks 'templateUrl' Component Medata results in templateName being displayed rather than displaying content #3116

Closed
@mwamufiya

Description

@mwamufiya

I'm not sure if this is intended behavior or not, but not having seen this behavior documented, here's a heads up.

OS?

Windows 10. version 1511 (OS Build 10586.589)

Versions.

angular-cli: 1.0.0-beta.19-3
node: 4.6.0
os: win32 x64

Repro steps.

  1. create a new app with ng. (ng new 'helloworld')
  2. run (ng serve) -> page loads and the app works. you see "app works" in the browser.
  3. go into the src/app/app.component.ts.
  4. change the 'templateUrl' metadata from
    templateUrl: './app.component.html',
    To
    writting backtick because I can't escape it in this editor.
    templateUrl: [backtick]./app.component.html[backtick]
  5. reload page or re-run ng serve

Expected result

  • the page would still load as it did before

Actual result

  • the page shows "./app.component.html" in the browser
  • the text 'App works' does not appear.

The log given by the failure.

no error logs in the console

Mention any other details that might be useful.

  • It should be noted that using backticks for the "selector" works as expected.
  • I have not tested to see if this also fails for "styleUrls" metadata.

In converting my project from systemjs to use angular-cli, this eventually came out as the culprit for downstream issues.

In this screenshot we see the expected result

  • "selector" has backticks.
  • "templateUrl" has singlequote

image

In this screenshot we see the observed behavior

  • "selector" has singlequote.
  • "templateUrl" has backticks

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions