Article From:

That is, I use angular, define a method name with ng-click, such as BB (), and then I change the attribute value of ng-click by attr (), changing the BB () to AA (), but I still triggered the BB () when I clicked on the page.Method, how can it trigger AA () function?

Answer 0:

You should make a function to decide which function to call dynamically. You can’t recognize angular when you run it.

function determine(flag){
        case 'xxx':
        case 'yyy':

Answer 1:

After changing the variables and adding $scope.apply (fun), manual inspection can be done manually to achieve refresh. You can try to put the function of attribute value in $scope.apply (fun).

Answer 2:

The idea is very complicated. Try the first floor method. It should be easy to use. One way to write two sets of logic is to decide which part to execute according to the parameters.

Leave a Reply

Your email address will not be published. Required fields are marked *