Click to edit in Mobile Angular UI

0. Assume the text’s ng-model to be changed is  {{someText}}

1. Create a modal.

2. Let there be an input in the modal. The input’s ng-model should not be {{someText}}, but {{anotherText}}

3. Let there be 2 buttons in the modal. One is "cancel", the other is "ok".  For "ok’,  ng-click = "submitChange()";  

4. Let there a button to turn on the modal. Instead of setting "ui-turn-on", use ng-click="showModal()" 

5. In function showModal(),  do 2 jobs:

   a. $scope. anotherText = someText;

   b. and $rootScope.Ui.turnOn("the_modal");

6. In function  submitChange(), do 2 jobs:

   a. send {{anotherText}}’s value to the server side

   b. If success, set {{someText}}’s value to {{anotherText}}’s value

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.