I am trying to implement metawidget on angular2 using metawidget javascricpt api. Till now I am able to generate UI form using buildWidgets. Now I want to append ng-model to input type for two way data binding, can someone suggest me how I can append attributes on input tag.
Thanks for your interest in Metawidget!
The typical way you would do this is to add a WidgetProcessor to your config. WidgetProcessors act on a widget after it has been built (by the WidgetBuilder) and before it is laid out (by the Layout):
metawidgetConfig = {
appendWidgetProcessors: [ function( widget, elementName, attributes, mw ) {
widget.setAttribute( 'foo', 'bar' );
return widget;
} ]
};
See an example here (albeit for Angular 1): http://blog.kennardconsulting.com/2014/05/angularjs-changing-date-format-of.html