- Forums
- Angular
- Angular - A Simple Example Of A Component File And Class
this is the basic structure for a new file if you were creating a new component file and a new component class in angular [4642], Last Updated: Mon Jun 24, 2024
Angular2
Tue Jan 31, 2017
0 Comments
422 Visits
if you need to create a new component in your angular 2, follow this template to create a new component and a new file. be sure to name the component and the file name in the naming convention: dash case (AKA kebab-case)
hero-detail-component.ts
import { Component} from '@angular/core';
@Component({
//We create metadata with the @Component decorator where we
//specify the selector name that identifies this component's element
selector: 'my-hero-detail',
})
//we export the class to make it available to other components.
export class HeroDetailComponent {
}
source: https://angular.io/docs/ts/latest/tutorial/toh-pt3.html