A model for our tags

Let's start with a tag model to represent tags within our system. Open up our model module file, located in src/app/model.ts, and add the following interface:

export interface Tag {  type: string;  hashTag: string;  title: string;  link: string;}

This interface represents tags; whenever we store tag information, we'll use this interface. Let's look at the individual fields and elaborate on their use:

  • hashTag: This is the text representation of a tag. All of our tags need to be identified uniquely, using this text representation. We can define the text representation of tags as follows:
    • Hashtags always start with a hash symbol (#).
    • Hashtags only contain word characters or the minus symbol (-).
    • All other details of a tag, ...

Get Mastering Angular Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.