Let's say I'm tied to have an accessible site that will be consultated with JS disabled.
I have a news list that I can summary this way:
<ul>
<li>News 1</li>
<li>News 2</li>
<li>News 3</li>
</ul>
Everytime you reload the page, you get the most recent news added, and the old one are discarded if you got more than 10 news.
Now, If I used Angulard JS, I have to put the data in a model, and an ng-repeat, and get rid of my static HTML. The list will be populated dynamically, so people with JS will see the list updated in almost real time.
What I need is to make the two work together. I need the static list, and if JS is activated, I want the current elements to be insert in the model and manage by angularjs.
Now my current way to do it is:
- when my model initialize, parthe the list DOM, extract the data manually, and remove all the child list
- inject angular template code in the list
- let angular do its magic
It sucks because you loose the declarative goodness of angular, plus you have a lot of boiler code is isn't even generic, so you rewrite it for every widget in you page.