It doesn't make sense to me that LINK1 is hardcoded as a constant value. In my perspective, since you are utilizing Angular as the development framework, LINK1 should be implemented as a component. By doing so, you can easily insert it anywhere in your code using <app-link1 />
, and the framework will handle it efficiently and securely.
Below is an example of how the component can be structured:
// link1.component.ts
@Component({
selector: 'app-link1',
standalone: true,
imports: [CommonModule],
templateUrl: './link1.component.html',
styleUrls: ['./link1.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class Link1Component {}
<!-- link1.component.html -->
<a href='https://sample.com/'>LINK 1</a>
<!-- example usage of the component -->
...
<app-link1 />
...
This approach provides you with the flexibility to define the href and link text as inputs whenever needed.