Self service portal ng-click works only after second click

lomouhamadou
Kilo Guru

Hi all,

I have an issue with the new self-service portal when using angular ng-click event. It only reacts after second click instead of first click.

Here is my client script part:

$scope.generatePDF = function(){

              var id_producer = g_form.getUniqueValue();

             

              // record producer html

              if(id_producer == 'aece069b4f3fd200203344f18110c7eb'){

                      pdf_HR_transfer_pension();

                     

              }

              /*else if(id_producer == 'bab1b2004fb71200203344f18110c7e2'){

                      pdf_HR_change_fiscal();

              }*/

              else if(id_producer == '85a9315b4f7bd200c7acf1728110c7c7'){

                      pdf_HR_pension_change_beneficee();

              }

              else if(id_producer == '004d235c4ffb1200203344f18110c763'){

                      pdf_HR_granting_reduction();

              }

              else {

                      alert('Option not Available for this form');

              }

Here is the call from the HTML part:

  <button ng-if="pdfButtonAvailable()" name="generatePDF()"   ng-click="generatePDF()" ng-disabled="submitted"   class="btn btn-primary">${Generate PDF}</button>

Any help guys, please

ctomasi            

4 REPLIES 4

lomouhamadou
Kilo Guru

What i know is also the ng-click is fired before the ng-model and that is the reason why it only reats after a second click.


However, i tried to use the ng-change then no reaction at all


fschuster, any thoughts on this?


Mouhamadou,



Hard to say without being able to debug it actively, but here are some thoughts:


  • In your client script you use $scope instead of the controller as notation (c instead of $scope - don't miss out on the var c = this; line if you want to use it). If you use $scope make sure $scope is also injected in the client script constructor at the very top.
  • You are using g_form.getUniqueValue() - per Github documentation that function is not supported, does it return the sys_id? (check by doing a console.log(id_producer)). I'd say it would be better to get the sys_id on the server side of things - just have a look at the Github Server API - there are functions for that (e.g. $sp.getRecord()).
  • The name of your HTML button is actually the function - not quite sure if that collides with the ng-click that actually does call the function. Try removing the () brackets from the button name.

lomouhamadou
Kilo Guru

Guys,



The ng-click is not really the issue.


I did a lot of tests and realized that this happens only when the the ng-click calls the function which calls another function by using glideAjax.


I suspect we have this as we cannot use ga.XMLWait (Mobile scripting)



Any suggestion ?