Saidh
Saidh

Reputation: 1141

Angular 2 - .ts appends in all local files?

I am developing an Angular 2 application and now I am facing an unexpected .ts file extension issue in all my local file includes.

See my code below

@Component({
  selector: 'home',
  template: require('./home.component.html')
})

Here I am getting error like

GET http://192.168.1.36/angular2/smd/app/home.component.html.ts 404 (Not Found)

How can I avoid the unwanted .ts extension from my local files?

Please suggest me a solution

Thanks..

Upvotes: 0

Views: 56

Answers (1)

Maximilian Riegler
Maximilian Riegler

Reputation: 23506

In your component annotation you only need to set the templateUrl to the path of your template file. Require is thought for loading other modules.

@Component({
  selector: 'home',
  templateUrl: './home.component.html'
})

Upvotes: 1

Related Questions