javascript - Common way to stop repetitive requests in angularjs -


As it is known, AngularJS does not support synchronous requests; But the question is not about it. I had to face a problem, so getting feedback can take longer than expected person and the person can resubmit the data. I would like to stop it

Are there any common underlying ways to do this?

You force ng-disabled to a property on that controller Which you can set before the true before the excerpt and false , the exhaor is complete click on the event and therefore the ng-click one If the button is disabled it will not file.

Documentation:

Update if you want with any element (like a ) You can use custom click handler to use ng-disabled ex:

  yourApp.directives.directive ('myClick', ['$ parse ', Function ($ parse): ng.Idirective {return {restrict:' A ', link: (scope, element: JQuery, attrs) => {var fn = $ parse (attrs.picClick); element.on ('Click', function (event) {// core disable logic detection if (attrs.disabled) return) scope. $ Apply (function () {fn (scope, {$ event: event});})}} }}}}}]);   

Of course, you want your element to be different in style, when it has the attribute disabled set to true.

Another way Alternatively you can use a combination of unique unique elements, only one ( ng-show )

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -