To learn AngularJS 2.x + learn the below concepts decorators and typescript classes.
Module Decorator
@NgModule({
declarations: [
AppComponent, TestComponent
],
imports: [
BrowserModule, HeaderModule, RoutingModule,
],
exports: [],
providers: [UserService],
bootstrap: [AppComponent]
})
Component Decorator
@Component({
selector: 'app-blog',
templateUrl: './blog.component.html',
styleUrls: ['./blog.component.css'],
providers: [HttpService],
})
Pipe Decorator
@Pipe({
name: 'safeHtml'
})
Directive Decorator
@Directive({
selector: '[tagDirective]'
})
Above all are the Decorators of angularJS to decorate the typescript class into angular module,component,pipe,directive etc. The classes who has decorators need to be declared in the declarations part of @ngModule and those who have not decorators only typescript casses need to be put in the providers of @ngModule (global all over module) or @Component Decorators.
You cannot declare single decorator like component,pipe etc. in multiple modules for this you need to make a shared module and export the decorators in the shared module and import the shared modules on other modules.