Ng2-Fun
Ng2-Fun

Reputation: 3393

Angular2 routes: can't find external html file

In angular2, if using internal template in @component, the route works. But if using templateUrl to add external template, it shows an error: can't find resources **.html. Do I need to add something else if using external template?

@Component{
   template: ``
}

@Component{
   templateUrl: "**.html"
}

Upvotes: 0

Views: 554

Answers (1)

user2263572
user2263572

Reputation: 5606

Do something like this:

templateUrl:"rootDir/Components/template.html"

My guess is you are using a relative path like this.

templateUrl:"./template.html"

But without seeing more code it is difficult to figure out the exact problem.

Upvotes: 1

Related Questions