Angular extend base component

Source: https://stackoverflow.com/questions/49320759/angular-4-extend-base-component

Since base class doesn't need to be instantiated on its own, it's abstract class and doesn't need to have @Component decorator.
If it has dependencies, and there's a chance that constructor will be omitted in child classes and inherited, base class should have @Injectable decorator:
@Injectable()
export abstract class BaseComponent implements OnInit {
  constructor(public dep: Dep) {}

  ngOnInit() {}
}

@Component({
  selector: 'app-child',
  templateUrl: './child.component.html',
  styleUrls: ['./child.component.css']
})
export class ChildComponent extends BaseComponent {
  // dummy constructor can be omitted
/*
  constructor(dep: Dep) {
    super(dep);
  }
*/
}

Không có nhận xét nào:

Is there a way to chain multiple tailwind css classes on a single hover instance?

 https://stackoverflow.com/questions/73524088/is-there-a-way-to-chain-multiple-tailwind-css-classes-on-a-single-hover-instance There is a wa...