If you have so many services/factories being injected, I have to wonder
what the controller looks like, meaning, are you doing too much in one
controller where somethings could exist in a directive (like elements you
use elsewhere)?
Also, if you some of these services (not resolves) are so common that you
use them in almost every controller, you could move them to one service, or
create a combined service that gets injected with all that are common and
just returns a single object reference to each service, if that makes sense.
The thing that sticks out the most is how many resolves you are doing.
Personally, I don't use resolves at all because they can slow the load of
my controllers and therefore the UX. (But I am not using ui-router either)
There are some approaches to getting initial data for the app if these
resolves are not needed to run but once on first load of the app. There
are also ways to get the data once inside the controller, without resolves,
and only show the UI view you want to show after the data is retrieved. I
can expand on this option more if need be.
I know, not great answers but just thinking it out with you.
On Tuesday, March 18, 2014 8:12:21 AM UTC-6, Jideobi Ofomah wrote:
>
> i currently have a controller as follows:
>
>
> .controller('AddNewInventoryCtrl', function ($q, $scope, $filter,
> $stateParams, currentFacility, storageService, $state, inventoryFactory,
> productTypes, programs, uomList, facilities, batchFactory,
> currentFacilityStorageUnits, $translate) {
>
> //controller implementation here
>
> }
>
> these are factories or services injected: $q, $scope, $filter,
> $stateParams, storageService, $state, inventoryFactory, batchFactory,
> $translate.
>
> while these: ( currentFacility, productTypes, programs, uomList,
> facilities, currentFacilityStorageUnits ) are collection of data resolved
> at add new inventory ui-router config inside resolve{ .... }
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.