How to add <ons-tab> dynamicaly with javascript

I try to customise the <ons-tab> depending on json string. For example if you are admin, you have an additional admin tab.
So I have a json string and I try to create <ons-tab> element based on the json field.
I don’t know how to set it properly because when use “$(’#tabbar1’).append” command tabs seems not properly set.

@joyeux86 This use case is not officially supported so there is no nice API for it. However, I think you can make it work easily. You need to know that ons-tabbar element is compiled at some point and its inner HTML structure is changed. You don’t want to attach the new tab to ons-tabbar but to the child that contains .tabbar class ('#tabbar1 .tabbar' in your example I guess). Also, do not attach the tabbar as the last child (appendChild), but to the second last. Something like tabbar.insertBefore(tab, tabbar.lastChild) should work (or its equivalent in jQuery).