custom form widget with a button, but the ng-click not working

jerryzheng
Tera Contributor

Hi Experts,

  I need to add a Cancel button  form, so I cloned the form, and simply added a button, a function to be triggered, nothing else changed, but  it seems the ng-click is not fire, i.e the function is not called by click the button, not sure if I miss anything trivial stuff? 

Thanks for any help!

Jerry

Here are the codes:

HTML part: added:

<span>
<button class="test" ng-click="confirmDelete()">
<span> Cancel </span> <span class="glyphicon glyphicon-trash"></span>
</button>

</span>

 

 

 

Client script part, added:

function confirmDelete(){
//spModal.alert('How do you feel today?');
spUtil.addInfoMessage("Hello, from confirm delete");
}

 

the button shows on the form from the portal at the position I want:, but nothing happen when clicking it

find_real_file.png

6 REPLIES 6

verda
Mega Expert

This issue seems to still exist: On the cloned version of the form widget, on any <a link they have href and ng-click on the same line. 

First question is why?

Second question,  href portion works, not sure why ng-click is even there but when href is removed ng-click does not work.

 

<span ng-repeat="rl in data.f._related_lists" ng-if="rl.visible">
<a ng-click="c.openRL('','')">{{rl.plural}}
<span class="label label-as-badge label-primary" ng-if="rl.count">{{::rl.count}}</span>
</a>
<a ng-if="::rl.type == 'REL'" ng-click="c.openRelatedList($event, {id: 'lf', table: '{{::rl.table}}', apply_to: '{{rl.apply_to}}', apply_to_sys_id: '{{rl.apply_to_sys_id}}', relationship_id: 

 

on client script:

var c = this;

function openRL(e, queryString) {
console.log('my code');

}

verda
Mega Expert

figure out the problem. Write the function like this instead on client script:

 

c.openRL=function(e, queryString) {
console.log('my code');