AngularJS and IE8, directive that compiles HTML

I have a directive that loads an article in HTML from a CMS via a REST API and a template file what should be compiled together with the article.


element.html(templateLoaded.data);
scope.document = theLoadedArticle;
$compile(element.contents())(scope);

This worked in most browsers except our old “friend” Internet Explorer 8. The reason is I have another directive in the loaded template file and I need to tell the DOM compiler about this (IE8 is cranky about non-html tags).

So, inside the template file I added:


<script type="text/javascript">
//Needed for IE8/9
document.createElement('my-directive');
</script>

Now it works. It could probably be done outside the template file as well.

Standard

WordPress, Drupal or Roll Your Own?

When should you use existing CMSs as WordPress or Drupal and when should you build one yourself?

Of course, building a CMS from scratch would be insane but with emerging technologies and standards such as git (for version control), Markdown (for editing), Neo4J (for metadata) and Solr or ElasticSearch for indexing the data, you can get extremely far by putting the pieces together yourself.

Add to that the recent rise in popularity of Javascript frameworks such as AngularJS or Backbone, with which you tend to get a cleaner split between REST-API and UI, and you don’t even have to render the web pages on a server. Static HTML-files with Javascript are fine.

So maybe the time has come to say goodbye to the web CMS that tries to do everything and say hello to a toolbox of world class, open source and free components that you put together yourself to build a framework?

Standard