To streamline the process of fetching data from the server and paginating it for all resources, I developed a custom ListCtrl. However, before setting it up, this controller needs to receive certain configurations such as the path to the resource and default limit.
My initial idea was to incorporate the ListCtrl within a larger controller and pass necessary parameters like this:
<div ng-controller="DashboardCtrl as dashboard">
<div ng-controller="ListCtrl as list" ng-init="list.init(dashboard.listParams)">
<... Iterate through list.items ...>
</div>
</div>
After some research, I came across articles suggesting that using ng-init
is not ideal and should only be utilized for list initialization purposes. Is there a more efficient approach that does not involve ng-init
? Or is this current method acceptable?