I'm working on a project to render HTML taking a special XML as input. I succeed already with the basic case. For example:
<mybutton name="layla"></mybutton>
is converted to
<div class="btn">Layla</div>
using a directive like
.directive('mybutton', function() {
return {
restrict: 'E',
scope: {
name: '@'
},
templateUrl: 'uicomponents/uiButton.html'
}
})
The real XML input I'll receive is:
<ui type="back_button" x="10.0" y="630.0"/>
I'd like to avoid changing the XML syntax but it can be done if necessary.
all screen components are in <ui></ui>
tags. The type
attribute defines the component.
How would you write directives for this kind of tags? It doesn't seem smart to create one huge directive for <ui>
elements and having a long switch-case inside for the attribute.