Page 1 of 1

Get values from input field (ionic)

Posted: Mon Oct 03, 2016 8:08 pm
by Kurt Spangsbjerg Petersen

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


Get values from input field (ionic)

Posted: Tue Oct 04, 2016 7:09 am
by Serhii Kulibaba

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...


Get values from input field (ionic)

Posted: Tue Oct 04, 2016 1:08 pm
by Elvin Chu

Get values from input field (ionic)

Posted: Tue Oct 04, 2016 6:12 pm
by Kurt Spangsbjerg Petersen

Wauw, thanks for great support :-)


Get values from input field (ionic)

Posted: Tue Oct 04, 2016 9:20 pm
by Kurt Spangsbjerg Petersen

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.


Get values from input field (ionic)

Posted: Wed Oct 05, 2016 1:26 pm
by Serhii Kulibaba

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


Get values from input field (ionic)

Posted: Wed Oct 05, 2016 9:25 pm
by Kurt Spangsbjerg Petersen

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.


Get values from input field (ionic)

Posted: Thu Oct 06, 2016 7:41 am
by Serhii Kulibaba

Please use composite variable in the ng-model attribute

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


Get values from input field (ionic)

Posted: Thu Oct 06, 2016 1:04 pm
by Kurt Spangsbjerg Petersen

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", {});