Repository navigation
Widgets
zehavibarak edited this page Oct 27, 2022
·
2 revisions
A widget has a server object that inherits from WidgetBase.
[Template("app-my-widget")]
public class MyWidget : WidgetBase<MyWidget.DataModel>
{
public override Task<DataModel> GetAsync(Void args)
{
...
}
public struct DataModel
{
...
}
}And an Angular component implementing WidgetComponent<T>.
import { WidgetComponent, BizDoc } from '@bizdoc/core';
@Component({
selector: 'app-my-widget',
templateUrl: './my-widget.widget.html',
})
@BizDoc({
selector: 'app-my-widget'
})
export class MyWidget implements WidgetComponent<DataModel[]> {
onBind(data: DataModel[]) {
...
}
}
interface DataModel {
...
}Angular widget component must have a @BizDoc decoration with matching to the backing object Template attribute.
The onBind() function receives the data returned by the server-side GetAsync() method.
Widgets accepts configuration Options to control their behavior.
Core widgets server-side objects can be overridden.
Moding Ltd.