Amit Chauhan
Amit Chauhan

Reputation: 1884

"....has no exported member"-error in importing component (Angular)

i am making a component called headerComponent and importing in app.component.ts but getting website/src/app/header/app.headerComponent"' has no exported member 'headerComponent' error my app.headerComponent.ts code is as follow

import { Component } from '@angular/core';

@Component({
 selector: 'header',
 templateUrl: './app/header/header.html'
 })
 export class headerComponent {}

and app.component.ts code is as follows

import { Component } from '@angular/core';

 import { headerComponent } from './header/app.headerComponent';

 @Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
   })
   export class AppComponent {
   }

Upvotes: 4

Views: 19411

Answers (2)

Pavlo Kozachuk
Pavlo Kozachuk

Reputation: 283

Fixed similar error by updating the Typescript version

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222532

You need to add the component to your module.ts

import { headerComponent } from './header/app.headerComponent';

then,

@NgModule({
  imports: [
  ],
  declarations: [
    headerComponent 
  ]

Upvotes: 2

Related Questions