Reputation: 19391
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
Upvotes: 4
Views: 244
Reputation: 7958
You can have a look at this commit, the examples are changed to reflect the deprecation of the controller:
https://github.com/angular/angular.dart/commit/5f8e27659ffb0140e0c153f8cecd627df273bfd2
Upvotes: 1