I think @*JeadoKo*, that the correct place to access your scope is within
Directive.
Theres a reason why Providers don't have access to the scope. There's a
reason for this separation. Hierarchy.
Try to implement your scope using methods inside a Directive. There the
scope is exposed. Design your app accordingly.
After all, the gods of angular want you to do so ;)
On Sunday, October 28, 2012 3:34:54 AM UTC-2, Jeado Ko wrote:
>
> Thanks khoi pham cao.
>
>
>
> 2012년 10월 25일 목요일 오후 3시 42분 47초 UTC+9, khoi pham cao 님의 말:
>>
>> Hi,
>>
>> I don't think it's such a good idea to not pass scope directly to your
>> service if you want it in your service. Passing things through arguments is
>> loose coupling and generally good design.
>>
>> If you don't want the whole scope available to the service then perhaps
>> make an object that contains everything you want in your scope and pass
>> that in instead.
>>
>> Vào 10:34:38 UTC+7 Thứ năm, ngày 25 tháng mười năm 2012, Jeado Ko đã viết:
>>>
>>> hi.
>>>
>>> I am making some provider function like below
>>>
>>> angular.module('test')
>>> .provider('test',function() {
>>> this.$get = function() {
>>> return function(scope){
>>> console.log(scope);
>>> };
>>> };
>>> })
>>>
>>> and I`d like to use it in controller
>>>
>>> angular.module('test2', ['test'']).controller('testCtrl',
>>> function($scope, test){
>>> test($scope);
>>> });
>>>
>>> I guess it would be fine....but if I dont want to pass $scope from
>>> controller directly to provider like below, how can I do that ?
>>>
>>> angular.module('test2', ['test'']).controller('testCtrl',
>>> function($scope, test){
>>> test();
>>> });
>>>
>>> is there way to know provider detect current controller $scope when it
>>> used in controller ?
>>>
>>>
>>>
--
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.