T
T
the5x2020-05-15 13:46:57
Angular
the5x, 2020-05-15 13:46:57

Where is the error when creating a component in Angular 2.2?

I want to create a component in Angular 2 (2.2)

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { SpinnerComponent } from './components/spinner';

@NgModule({
  declarations: [SpinnerComponent],
  imports: [CommonModule],
  providers: [],
})
export class SpinnerModule {}


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

@Component({
  changeDetection: ChangeDetectionStrategy.OnPush,
  selector: 'app-spinner',
  template: require('./spinner.html'),
})
export class SpinnerComponent {
 
}


It throws this error:

'app-spinner' is not a known element:
1. If 'app-spinner' is an Angular component, then verify that it is part of this module.
2. If 'app-spinner' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question