You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
To facilitate ng 1.x to 2.x migration, ng 1.x should add a new directive helper to mimic Angular 2.0's Directive, in the same way the proposed angular.component #10007 would mimic Angular 2.0's Component. I am proposing calling it "decorator" after the former name it had in NG 2.0, since it's goal would be to decorate an element with behavior and obviously a major change to angular.directive itself would break lots of code. Key features of decorator would be:
no template
defaults to restrict: 'A'
hierarchical injection on the controller -- this is the big one - would only to be able to inject services from the parent component, browser singleton services, and ancestory/parent/child/sibling directives.
I'd propose an api as follows:
angular.decorator('decoratorName',function(){return{controller: ['$element','serviceOnComponent','parent:parentElementDirective','ancestor:ancestorElementDirective','sibling:siblingDirecitve','query:childDirectives',DecoratorController],bind: {'value': 'attribute'}};functionDecoratorController($element,serviceOnComponent,parentElementDirective,ancestorElementDirect,siblingDirective,childDirectives){// add some behavior to $element here}});
As an alternative proposal, add the ability to have hierarchical constraints on injection in standard directives, and also add the ability to inject other directives into a directive's controller.
The text was updated successfully, but these errors were encountered:
To facilitate ng 1.x to 2.x migration, ng 1.x should add a new directive helper to mimic Angular 2.0's Directive, in the same way the proposed angular.component #10007 would mimic Angular 2.0's Component. I am proposing calling it "decorator" after the former name it had in NG 2.0, since it's goal would be to decorate an element with behavior and obviously a major change to angular.directive itself would break lots of code. Key features of decorator would be:
I'd propose an api as follows:
As an alternative proposal, add the ability to have hierarchical constraints on injection in standard directives, and also add the ability to inject other directives into a directive's controller.
The text was updated successfully, but these errors were encountered: