See if this directive works:
app.directive('vbox', function() {
return {
link: function(scope, element, attrs) {
attrs.$observe('vbox', function(value) {
element.attr('viewBox', value);
})
}
};
});
HTML:
<svg height="151px" width="1366px" vbox="{{ mapViewbox }}">
Plnkr. You'll need to "Inspect element" or "View source" to see the svg tag.
Update: If your app includes jQuery, see Does the attr() in jQuery force lowercase?
@Niahoo found that this worked if jQuery is included (he made an edit to this post, but for some reason, other SO moderators rejected it... I liked it though, so here it is):
element.get(0).setAttribute("viewBox", value);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…