Updating Modal with controller model - ionic-framework

I am trying to use dynamic content inside my modal using angular controller model.
My codepen: codepen.io/anon/pen/dpJxa1
I am trying to increment $scope.count whenever user clicks Create contact button inside the modal. This count will be used to populate first name in the modal.
Even though the count is increasing which is shown in alert, it is not reflecting the modal. How can I listen for the changes in my model and show it in modal.
Thanks in advance.

Call the .show() method on your modal again, after each time you want the modal to update content. So add something like $scope.myModal.show(); to your increment function.

Related

prevent parent page from refreshing after submitting a modal inside a modal

I have a form in which two modals are there, one inside another. after submitting the second modal, page refreshes and exits from first modal and loads the parent page. What I want to achieve is that, if I submit the second modal, it submits the value and reload to first modal not to parent page. Any suggestions will be very much helpful
I have used the event.preventDefault(); function but its not working

My tableview does not reload when pressed back and searched again

So i have a search page. The word the user searches is passed to the next view controller. Now instead to using prepare for segue and passing the value, I store it as a global variable and just to a performSegue.
The problem is when I go back using the back button of the navigation controller, the new data doesn't reload when I click on search. It shows the old data.
Link of the images is given below. Now 1st one is a search for Rahul. It shows the correct result now the next is when I go back and search for Rohan it shows the result for Rahul itself.
https://i.stack.imgur.com/irUwo.png
https://i.stack.imgur.com/fthOm.png
https://i.stack.imgur.com/F7wKJ.png
Once perform to the result view controller, ask your main thread to call tableView.reloadData() after you received the new global value you pass. If this can't help you, please provide your code so that we could help you by clearly understand your situation.

Display partial view as POPUP in mvc2?

I want to show result ( as list ) with fade effect in mvc2 .
Current it shows on same page and main form is displaying below result. How to display partial view results with fade effect popup in mvc2.
Suggest something.
Create a action method in your controller which returns a partialview
from you main page. write a js/jquery code to open a popup. you can use the fade effect from http://jqueryui.com/effect/
call you action method to load your partial view

TableViewNavigationController issue- newbie

I have a TableViewNavigationController. On my first page, i have displayed a table-view, and on the navigation bar there is a add button, where the user could add a record.
once the user clicks on the add button, a UIView will be displayed and the user could enter details and submit, and then when the user clicks on the back button on the TableViewNavigationController, the first page which contains the table-view is displayed with the added record.
But, for me multiple records are displayed, and when i restart the stimulator it shows the correct set of records. Why is this and how can i prevent this?
EDIT : Can someone tell me which method fire's when we click the back button of the TableViewNavigationController ?
Are you updating the datasource of your tableview with the right array-data?
If not,
[yourTableView reloadData];
Should fix that.
You likely need to use the reloadData method for your tableView when returning to the table. And possibly refresh your data. Is it coming from an array or using fetched results controller? Either way, it sounds like you're seeing odd results because the data has changed.
You should show us some code, so we can help you more.
The method that get's called when you change a view is the viewWillAppear
Since you mentioned that you are reloading your Table Data Source, are you sure you are adding the new entry to your existing Data Source (your Array) ?
Is your Array an mutable Array, so you can add the new record to it?

iphone - how to mentain the state of UIWebView?

i am having a UIWebView showing and HTML page that has some checkboxes, radio buttons. My Application has tabbar controller that switches b/w two controllers. How i can maintain the current state of UIWebView. ( e.g. i have selected a checkbox and i change the tab and go to other ViewController and again come back to UIWebView. the WebView resets itself and goes to the start... i want to maintain the state of UIWebView ( all the checkboxes clicked) .. how i will do that ??
any idea ??
thanks in advance
It sounds like you're loading your web view in viewDidAppear:, or some other method that gets called each time you switch to the tab. If you load your web view in viewDidLoad:, it will only get loaded once, and will retain its state when you switch tabs.
EDIT: When I wrote this answer back in 2009, I apparently didn't understand the view controller life cycle as well as I thought I did. Corey Floyd was right. The viewDidLoad: method can also get called multiple times, because UIViewController will unload its view in low memory situations if the view isn't being displayed. When the user switches back to the view, viewDidLoad gets called again to reconstruct the view.
How embarrassing.
I have an idea that might help:
to get the status from your app to the webpage, give the variables' values as request parameters with the called URL and let the webpage handle them and view the form elements accordingly.
to get the status from the webpage back to your app, let the webpage be refreshed each time any of its element is updated, and with the new URL give the new values of the changed elements. Back to your app, you can implement the UIWebViewDelegate and inside the method WebViewDidFinishLoad (or WebViewDidStartLoad as you prefer) use the webView.request.URL to parse the GET parameters and update your app accordingly.
hope this will help.