Samples Automation

Every component will have sub-directory called demo. Every demo has its own class definition and html template. For the naming convention, the demo component should add "demo" as a prefix and an increment number as a suffix ex: demo.button-1.ts, demo.button-1.html, ...etc. Every demo should import the actual class of the component.

-src
   -app
      -components
       -exampleComponent
          -example.component.ts
          -example.component.html
          -example.component.css
          -demo
             -demo.example-1.ts
             -demo.example-1.html
             -demo.example-1.css
             -demo.example-2.ts
             -demo.example-2.html
             -demo.example-2.css

Let's take for an example a customized button developed called cf-button:

cf-button.component.ts

import { Component, Input } from '@angular/core';
@Component({
    selector: 'cf-button',
    templateUrl: './button.component.html',
    styleUrls: [ './button.component.css']
})
export class ButtonComponent {
   @Input() title: string;
}

button.component.html

demo.button-1.ts (Note that it is importing the component)

demo.button-1.html

demo.button-2.ts (Note that it is importing the component)

demo.button-2.html

Then the hosting Sample Component in the project should import the sample component:

host.component.ts

host.component.html

Last updated