X Tutup
Skip to content

Cryptic error when # included in templateUrl #3543

@jessegood

Description

@jessegood

Not sure how common this will be but I ran into a cryptic error when a # is included in the string to templateUrl. Simple example:

@Component({
  selector: 'app',
 })
@View({
  templateUrl: `
    <p #p>Hello</p>
  `
})
export class App {}

In the above example, it was just a goof and I forgot to change templateUrl to template.
Without the # you get a nice error message:

EXCEPTION: Failed to load the template for "App" : Failed to fetch url "http://127.0.0.1:8080/

Hello

With the # you get this:
Firefox:

EXCEPTION: TypeError: parts is null

Chrome:

EXCEPTION: TypeError: Cannot read property '1' of null

From what I've found the same error happens with any string that has a # in it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup