Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"....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 {
   }
like image 885
amitchauh4n Avatar asked Oct 29 '22 09:10

amitchauh4n


1 Answers

You need to add the component to your module.ts

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

then,

@NgModule({
  imports: [
  ],
  declarations: [
    headerComponent 
  ]
like image 69
Sajeetharan Avatar answered Nov 15 '22 07:11

Sajeetharan