Components are changing constantly, for that reason is important to understand the structure of a component in order to customize Its functionality. This guide is about how to update our already created components with new events functions or properties.
A lot of events, methods and properties of our components extends from ControlComponent, this is the first place that we have to take as reference when we want to implement something new.
Creating properties
There are some properties which do not extends from control, and belongs to a single component. Lets take numericUpDown component as example. This component has some properties that do not extends from ControlComponent.
We need find NumericUpDown.ts file.
Add new properties.
/** * @param value Contains the number of decimal places to display. */ set decimalPlaces(value: number) {this.model.DecimalPlaces = value; } get decimalPlaces(): number {returnthis.model.DecimalPlaces; }/** * @param value the value to increment or decrement the spin box. */ set increment(value: number) {this.model.Increment = value; } get increment(): number {returnthis.model.Increment; }/** * @param value Contains the maximum value for the spin box. */ set maximum(value: number) {this.model.Maximum = value; } get maximum(): number {returnthis.model.Maximum; }/** * @param value Contains the minimum allowed value for the spin box. */ set minimum(value: number) {this.model.Minimum = value; } get minimum(): number {returnthis.model.Minimum; }
Some properties need a decorator on its setter to notify WebMap Service about the change.
/** * @param value Contains the value assigned to the spin box. */ @NotifyChange('Value') set value(value: number) {this.model.Value = value; }
Binding on HTML.
Most of the time we have to bind those new properties on html file using proper angular structure.
The way that we call every property is on model.ts file that you can find on every single component.
exportlet model = {'DecimalPlaces':0,'Enabled':true,'Increment':3,'Maximum':100,'Minimum':0,'ProjectionId':'16','UniqueID':'n5m3r1c5pd0w4-c0mp0n3nt-05ds2sdf-0fd51dsf','Value':2};
Creating Events
Same as properties, there are some events that belongs to a specific component, events have the particularity of being emitted.