i have a form that is being loaded with the use of schema-form
, in that form i have a field MaxCards
his value is the value from db, and it can be null in the server-side i transformed null to -1
MaxCards = domainColumn.MaxCards.HasValue ? domainColumn.MaxCards.Value : -1
When the value -1
is loaded i dont want to show it in the form UI, instead i want to show an empty string.
How can I achieve it?
this is how i load the form: (Key: MaxCards is the field that i am talking about)
vm.form = [{
key: 'Name',
readonly: false
}, {
key: 'MaxCards',
readonly: false,
fieldHtmlClass: "editColumnModel-maxCards"
}, {
key: 'Description',
readonly: false,
type: 'textarea'
}];
You can try, replacing your -1 values, though I would suggest you to return blank space from your service/controller instead of -1 (null) if the type safety is not a concern.
{{ domainColumn.MaxCards.Value.replace('-1', ' ') }}
Or
$scope.domainColumn.MaxCards.Value.replace('-1', ' ');
I have not tested this nor I am sure what values your code returns, so please feel free to tweak this code a little.