Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Idea $this in directive locals calls #13247

Closed
@jpolo

Description

@jpolo

It would be nice to have a normalized reference to the locals for directive expression.
I've proposed $this but other candidates could be better ($locals, etc...)

Example

angular.directive("fooBar", function () {

   return {
     scope: {
       ngCallback:"&"
     },
     compile: function ($scope) {
       var ctx = {
       foo: "bar"
       };
       ctx.$this = ctx;// Keep a reference to the locals

       $scope.ngCallback(ctx);
     }
   };
})

Allows to easily dump available locals

<foo-bar ng-callback="log($this)">

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions