Skip to content Skip to sidebar Skip to footer

Failed To Load App.component.html In Plnkr

Plnkr link: https://plnkr.co/edit/910M73kwYKc8xPlSIU57?p=preview Directory: app.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-brow

Solution 1:

Angular can't resolve relative path of app.component.html. Just replace ./app.component.html with src/app.component.html and you are good to go.

import { Component, OnInit } from'@angular/core';
import { Router } from'@angular/router';

    @Component({
        selector: 'my-app',
        templateUrl: 'src/app.component.html'
    })
    exportclassAppComponentimplementsOnInit {
        ngOnInit() {
            console.log('oninit')
        }
    }

There are other alternatives to do this but angular-cli or webpack handles relative path on their own which are more preferrable.

Post a Comment for "Failed To Load App.component.html In Plnkr"