As Controller
is deprecated, is there good replacement for it?
I understand, why it was deprecated, but now need to find a replacement for it.
Assuming that I need to publish some functions to HTML (so Decorators couldn't be used), but without any template HTML (so Component couldn't be used).
Moreover, if there is a state, that these functions could 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>
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 press two times on first button, then clicking to second button will issue request to someUrl/1
and not someUrl/3