I have a text file in assets folder that contains some html to be rendered in a div on a specific component.
Is there a way to read that file and assign the contents to a string variable without user interacting with view (with input file type) in ngOnInit.
My findings If I put the html contents in json object, we will have to remove all line breaks from it. Meaning it will be a string without line breaks like this.
{
"html": "<h1 class=\"user\">Name</h1><p>Ahsan</p>"
}
This has a limitation for designers, They will be converting html to multi-line string and we will also be removing the escape sequences.
How this can be achieved with text files.
Reasons to do this
I want to do it because, I want to avoid rebuilding and publishing me entire angular app for some content changes. Even for some content changes I have to rebuild and republish the application.