Adding condition checks to ma-set-point-value
-
Heya,
This question is in 2 parts:
Is there a way to display a response to the user that the value they entered has exceeded the bounds specified in the data point?
I created a virtual point "Angle X Setpoint" and set the high and low limit to be 5 and 0 (and checked Prevent extreme sets). When a user enters a value into the field and clicks set, the operation appears to succeed as the button shows the check mark and there is no error. However, when you examine the data point, the value was not saved.
Does ma-set-point-value have the ability to display an error response or at least show the save was unsuccessful?
Do you have any suggestions if I wanted to add custom condition checks to the ma-set-point-value object? Would I have to create my own component so I could add the condition checks?
Thanks
IanPS: mango v3.5.6
-
Hi Ian,
My first suggestion for 1) involves using a number input with the desired mins and maxes, then a ma-button/md-button to use the
point.setValue( numberFieldVal)
<md-input-container> <input type="number" minimum="0" maximum="5" ng-model="angleToSet"/> <md-button ng-click="anglePoint.setValue( angleToSet ) " class="md-primary md-raised">Set Angle Value</md-button> </md-input-container>
Do you have any suggestions if I wanted to add custom condition checks to the ma-set-point-value object? Would I have to create my own component so I could add the condition checks?
That would be best. As you know, the components in the UI all use the REST API, so use that to enable you to write your own checks etc.
In fact if you're trying to do the same above, you may as well look at the github and see Jared's approach and work from there. You could then likely set different "setValue" calls so when setting a point value, you can run different checking algorithms and set alerts using an alert or $mdToast or the like.Fox