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, ...