Trying to assign a variable to the templateUrl
in my component, but it's not functioning as expected.
@Component({
selector: 'article',
templateUrl: '{{article.html}}',
styleUrls: ['styles/stylesheets/article.component.css']
})
export class ArticleComponent implements OnInit {
constructor(private route: ActivatedRoute, private articleService: ArticleService) { }
articleArray = this.articleService.getArticles();
article: Article;
ngOnInit(): void {
this.route.params.forEach((params: Params) => {
let headline = params['headline'];
this.article = this.articleService.getArticle(headline)
});
}
}
I'm finding solutions for Angular 1.X everywhere I look, which is quite frustrating. Upon inspecting the browser console, I noticed that {{article.html}} isn't being resolved and is displayed as is. Manually setting the path works fine, so I believe the issue lies within this specific code block.