Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Ionic 4 - returning data from a function

Hi all,

apologies if this is a daft question, but I am re-writing a major app from Ionic1 to Ionic4 and have a challenge.

I need to return data from several functions, but I get the msg:
"A return statement can only be used in a function body"

The function I have created, is as follows:
Name: getTeamNameFromID(id) (type:method)
the code simply loops around an array until it finds the id passed by the caller, then returns the name in the array at that point.

Can anyone tell me how I return the string please?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Ionic 4 - returning data from a function

Hello Andy,

You can ignore this message, it works fine if you return a string right in that function

Return to “Issues”