Module not found in angular 2

Srikanth Reddy

I'm newbie to angular 2. I had created a custom component and even did registered in app.module.ts Find my folder structure :

enter image description here

emp.component.ts :

import {Component} from '@angular/core'

@Component({
selector:'emp-tag',
templateUrl:'./Employee/emp.component.html'
})
export class EmployeeComponent
{
    title : 'This is Employee Component';
}

emp.component.html :

Hai {{title}}

Registered in app.module.ts file as like below :

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import {EmployeeComponent} from './Employee/emp.component'

@NgModule({
  declarations: [
    AppComponent,
    EmployeeComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

When I run my application by using ng server --open, I'm facing a compile time error as like module is not found in command prompt window as like below image

enter image description here

From my folder structure, I had given correct path in app.module.ts file.

Sajeetharan

Just change the path as follows, because you are in the same folder

templateUrl:'./emp.component.html

Complete code

@Component({
selector:'emp-tag',
templateUrl:'./emp.component.html'
})
export class EmployeeComponent
{
    title : 'This is Employee Component';
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related