Ok, yes the code I was looking at was using coffee script behind the 
scenes... Thought I was missing something, you guys cleared things up for 
me.

Thanks

On Thursday, 12 June 2014 18:08:23 UTC+2, Kevin James wrote:
>
> Ephraim,
>
> was that code generated by CoffeeScript per chance? CoffeeScript 
> automatically returns the result of a functions last expression (implicit 
> returns). As far as I can tell angular will ignore the pre/post link 
> functions return value; either cs is generating the code or someone is 
> returning a value for.. fun? So no, it is not necessary to return a value 
> from linking functions / the value is not used for anything. Hope that 
> helps.
>
> On Tuesday, June 10, 2014 3:28:53 AM UTC-7, Ephraim Moss wrote:
>>
>> I have noticed in some directives return statements are added in the link 
>> function on a directive. in the example below it is a call to $watch but I 
>> have seen other things like scopes etc. Or in a controller where the last 
>> call to set a scope variable is returned. Is this necessary? what is this 
>> used for?
>>
>> angular.module('angular-flot', []).directive('flot', function() {
>>   return {
>>     restrict: 'EA',
>>     template: '<div></div>',
>>     scope: {
>>       dataset: '=',
>>       options: '='
>>     },
>>     link: function(scope, element, attributes) {
>>     ...
>>     ...
>>     ...
>>     *  return scope.$watch('options', onOptionsChanged, true);*
>>     }
>>   };
>> });
>>
>>

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