hi there.. i'm semi-new to angularjs, ie, i've been using it for a while
now but i have no clue if what i'm building is against best practices or
not! :)
i'm coming to a point in my application where it's becoming apparent due to
changes in requirements that certain features should have been done by
creating a service, since multiple different places in the application are
needing to do the same thing.
a while back, i needed to open modals. this type of requirement is very
easy to identify as "something that requires multiple places to do the same
thing". back then, i was less familiar with services and factories and
solved this problem by creating a function defined in the $rootScope, so
every time i need to open a modal now, i include $rootScope in the
controller that needs it and open it with a function that goes something
like $rootScope.modal('open',url);, and close it with
$rootScope.modal('close','');
is this way of doing it wrong or against best practices? i'd like to know
if there is a performance difference between creating a service and just
defining a lot of $rootScope functions?
thanks!
--
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.