Sunday, 29 December 2019

Angular (7) component accepts only html files

Component is defined like this:

import {Component} from '@angular/core';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less']
})
export class AppComponent {

}

I would like to load in some specific components instead of "app.component.html" a file with extention htm "app.component.htm"

@Component({
  selector: 'app-root',
  templateUrl: './app.component.htm',
  styleUrls: ['./app.component.less']
})

from some reason it doesnt work it says:

ERROR in ./app.component.htm 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
<p>
  app component works!
</p>
「wdm」: Failed to compile. 

Please help me find a way to load an htm file? I am aware that there is a way to bootstrap with Webpack, I would like to keep the current build of ng-serve\cli angular.json!

Thank you!



from Angular (7) component accepts only html files

No comments:

Post a Comment