Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Get values from input field (ionic)

Hi

I have a modal view showing content from a database. When pressing the update button I want the values from the input text fields transferred to a new page.

I've tried to use Appery("InputName").val(); to read the values (from the new page).

How can this be done?

Image

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

Get values from input field (ionic)

Hello Kurt,

Please set an attribute ng-model for that input component. After that you will be able to read it's value in the scope variable which you assigned to that attribute. Please look at this tutorial to understand how it works: https://blog.appery.io/2015/11/unders...

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Get values from input field (ionic)

Wauw, thanks for great support :-)

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Get values from input field (ionic)

The only problem is that the original value from the DB (shown in the input fields when the page is loaded) dissapears when using the ng-model.

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

Get values from input field (ionic)

Could you show us how do you set these values from the database service to the scope variable?

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Get values from input field (ionic)

Hi Sergiy
I have a simple input field showing the database values by using ng-repeat. Works perfect. But when I add the ng-model (as suggested in the video above), then the ng-repeat does not work (the fields are blank). The ng-repeat and the ng-model can't be used together.

Actually want I want to do is quite simple. I have a list of my database values (page 1). When I press a list item I need to go to a new page (page 2) where I can see and edit the item value and update the database. All the services are in place. I just miss the step where I can transfer the values from page 1 to page 2.

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

Get values from input field (ionic)

Please use composite variable in the ng-model attribute

http://stackoverflow.com/questions/14...

Kurt Spangsbjerg Petersen
Posts: 0
Joined: Wed Aug 17, 2016 8:51 pm

Get values from input field (ionic)

Hi Sergiy
Thanks, but I can't get this to work. ng-repeat and ng-model in the same input field is tricky. I’ve played around for hours with composite variable. Either the ng-repeat or the ng-model shows the right values, but not both at the same time. I have to handle this in another way.

I have now build an update function, UpdateEntry().

In this function I have my variables available (an array).

How can I from a function send variables to another page by using
Apperyio.navigateTo("itemlist", {});

Return to “Issues”