Thanks to all of you.

On Thursday, April 9, 2015, Rafael Bernard Rodrigues Araujo <
[email protected]> wrote:

> Hi, Jean.
>
> Sorry, but I can't look into your demo, but I have an application with
> this behavior and I think you can try to step-by-step improving your
> knowledge and code: first, you can share your service through your
> controllers using the dependence injection. Example:
>
> ===
> app.controller('OneController', ['$scope', 'myService', function($scope,
> myService) {
>    $scope.testing = function () {
>     myService.myCall();
>   };
> }]);
>
> app.controller('TwoController', ['$scope', 'myService', function($scope,
> myService) {
>    $scope.secondTesting = function () {
>     myService.myCall();
>   };
> }]);
>
> app.service('myService', function($http){
>   this.myCall = function () {
>     alert('OK');
>   }
> });
>
> ===
>
> And you don't need to manipulate the DOM. Inside your controllers you can
> change the app behavior using scope variables.
>
> Take care,
>
>
> --
> Rafael Bernard Rodrigues Araújo
> about.me/rafaelbernard
> Analista de Tecnologia | Hospedagem de sites - http://oservidor.com
>
> On Thu, Apr 9, 2015 at 11:03 AM, Jean Spiteri <
> [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
>> Hi all, I am a beginner in Angular.js. I don't know if this is the
>> correct place to post. However, I've been searching for the past days and
>> haven't been able to find a solution for this problem. I have a service
>> which needs to be called from different parts of my app. The code can be
>> found here: https://gist.github.com/Liongold/3158060510cc94ad8e6d. As
>> you can see, the service includes DOM manipulation but from what I've seen
>> this is incorrect and should be done in a directive. Can anyone show me an
>> example or help me with how I can use a directive? I would like to have it
>> that when the service is called, the directive triggers automatically.
>>
>> Thanks to all those who've read this and sorry for disturbing.
>>
>> --
>> 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]
>> <javascript:_e(%7B%7D,'cvml','angular%[email protected]');>.
>> To post to this group, send email to [email protected]
>> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/6McwSHg_Rn4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected]
> <javascript:_e(%7B%7D,'cvml','angular%[email protected]');>.
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Sincerely,
Jean Spiteri.

-- 
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.

Reply via email to