I am using force:recordData in a lightning component to get the data by passing in the Opportunity id. It works without any issues. However, I would like to change the opportunity stagename value from let's say "01-Prospecting" to just "Prospecting" by leaving out the numbers and the hyphen. The string functions I saw for the lightning components don't seem to help to get a substring out of a string.
Below is the code:
<force:recordData aura:id="recordHandler"
recordId="{!v.opp.Id}"
fields="Id,LastModifiedDate,Name,Account.Name,StageName"
targetFields="{!v.simpleRecord}" />
I would like to get a substring out of the {!v.simpleRecord.StageName}.
I tried using the init handler to set a different attribute with the substring from the controller method (doInit), but it seems the record data is fetched after the initialization of the component and I get null for the v.simpleRecord.
Please let me know if the question is not clear and I will try to post some examples.
Thanks.