Skip to content
This repository was archived by the owner on Sep 7, 2018. It is now read-only.
This repository was archived by the owner on Sep 7, 2018. It is now read-only.

use of private $$scope instead of $scope in class for Directive  #4

Description

@afaayerhan

I don't get it here, the injection of $scope and instead taking and making use of $$scope which is an internal implementation which is not supposed to be expose. or is it a typo or there is a reason for it?

@directive('ngModuleName', 'atSomeDirective')
class SomeDirectiveController {

public static controllerAs: 'someDirectiveCtrl';
public static templateUrl: string = '/partials/some-directive.html';
public static link: angular.IDirectiveLinkFn = (scope, element, attrs, ctrl: SomeDirectiveController) => {
    ctrl.init(attrs.atSomeDirective);
};

constructor(
    @inject('$scope') private $$scope: angular.IScope,
    @inject('$parse') private $$parse: angular.IParseService
) {
    // do stuff with $$scope and $$parse;
}

public init(anArg: string): boolean {
    // do some stuff with this.$$parse and this.$$scope
}

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions