What you have works fine. If you need to share something between
controllers, consider moving it a service. If you are doing UI
manipulation with jQuery, consider making a directive.
On Wednesday, January 8, 2014 6:30:53 PM UTC-7, Jake K. wrote:
>
>
> Hello
>
> I was wondering what is the proper way of declaring functions and
> variables inside controllers that are not part
> of the scope, for instance:
>
>
> function controller( $scope ){
>
> $scope.var;
>
> var myvar = 'Hello world';
>
> var myfunction = function(){
> alert('Hello world');
> }
>
> }
>
> How should I properly declare myvar and myfunction inside a controller?
>
> Thank you
>
> PS: The reason why I do this is because some variables inside my
> controllers act more like helpers, and
> do not need to be bound or displayed in the view.
>
> 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/groups/opt_out.