Since it's Controllerout of date, is there a good replacement for it?
I understand why he is out of date, but now he needs to find a replacement.
Assuming I need to publish some functions in HTML (therefore Decorators could not be used), but without any HTML template (therefore Component could not be used).
In addition, if there is a condition that these functions can use.
Example:
<div>
<div request-sender>First sender:<button ng-click="sender.send()">Send1</button></div>
<div request-sender>And <button ng-click="sender.send()">Send2</button> - second sender</div>
</div>
the code:
@Controller(selector:'request-sender')
class SenderCtrl {
int counter = 0;
Http _http;
SenderCtrl(this._http);
void send() { counter++;_http.get('someUrl/$counter'); }
}
So, if I double-click on the first button, then clicking on the second button will ask for someUrl/1, rather thansomeUrl/3
source
share