Skip to content
Manav Sehgal edited this page Jan 31, 2016 · 4 revisions

Best Practices

Starter Deviations (SD) from Angular.io Tutorial

SD1 Component files and names do not add "Component" suffix. Why: Smaller file names for style, template, component files.

SD2 Goes with SD1, name component models as entity.model.ts and model class/interface as EntityModel.

Naming Conventions from Angular.io Tutorial (AT)

AT1 All component names end in "Component".

AT2 All component file names end in ".component". For example, export class AppComponent {} for app.component.ts. Another example export class HeroDetailComponent {} for hero-detail.component.ts. Note starter deviation from this rule as SD1.

AT3 Spell our file names in lower dash case (AKA "kebab case") so we don't worry about case sensitivity on the server or in source control.

AT4 Adopted a convention in which we spell the name of a service in lowercase followed by .service. If the service name were multi-word, we'd spell the base filename with lower dash case (AKA kebab-case). The SpecialSuperHeroService would be defined in the special-super-hero.service.ts file.

AT5 Prefix selectors with project name/shorthand to avoid naming clashes. So AngularPages project selectors are prefixed with ap-selector-name.