class Article {
Container: HTMLElement;
Title: HTMLElement;
Description: string;
ArticleLink: string;
Image: HTMLElement;
constructor(title: string, description: string, article_link: string, image_link: string) {
// object initialisation
this.Container = document.createElement('div');
this.Title = document.createElement('h1');
this.Image = new Image();
let link = document.createElement('a');
// attributes
link.innerText = title;
link.setAttribute('href', article_link);
this.Image.setAttribute('src', image_link);
this.Image.setAttribute('title', description);
}
}
let root = document.getElementById('root');