This is bogus. It doesn't do anything.
I had never seen code like that and it isn't documented as far as I can see.
To be sure I had a look at angularjs source code and found that the return
value is simply ignored.
Somebody correct me if I am wrong - maybe on some old version of ng it
actually did something?!
On Tuesday, June 10, 2014 12:28:53 PM UTC+2, 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.