In case if you need to generate an Angular component with another prefix you need to use the --prefix
flag. Example:
ng g c test --prefix=Exclusive
The result will be the following:
CREATE libs/feature-new/src/lib/test/test.component.scss
CREATE libs/feature-new/src/lib/test/test.component.html
CREATE libs/feature-new/src/lib/test/test.component.spec.ts
CREATE libs/feature-new/src/lib/test/test.component.ts
UPDATE libs/feature-new/src/lib/feature-new.module.ts
Let’s open the test.component.ts
. The selector will have the defined prefix. In our case it’s Exclusive
:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'Exclusive-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
constructor() { }
ngOnInit(): void { }
}