javascript - Why do some angular $scope functions "return" an operation? -
I've got some code that looks like this:
$ scope.open = Function ($ event) {$ event.preventDefault (); $ Event.stopPropagation (); Return Scope Open = true; }; Why is this returning an assignment? What does it do? Is there any advantage of doing this or not?
This is basically:
$ scope.open = Function ($ event) {$ event.preventDefault (); $ Event.stopPropagation (); $ Scope Open = true; Return Scope }; The advantage is that it saves a line of code, probably not worth it.
This can also be compiled with a cryptographic code, which was originally viewed:
$ scope.open = ($ event) - & gt; $ Event.preventDefault () $ event.stopPropagation () $ scope.opened = true The coffee script always gives the result of the last line in a method, so it can return a value from those tasks You will normally expect nothing to happen again.
Comments
Post a Comment