Globally register a directive in Angular Globally register a directive in Angular angularjs angularjs

Globally register a directive in Angular


My understanding is that you have to opt in to all custom directives at the component level. Only PLATFORM_DIRECTIVES are implicitly included (ngFor, ngIf etc.).

However, you can register your own custom directive as a PLATFORM_DIRECTIVE

import { provide, PLATFORM_DIRECTIVES } from '@angular/core';bootstrap(RootCmp, [  provide(PLATFORM_DIRECTIVES, {useValue: YourCustomDirective, multi: true}),]);

Here is an article that talks more about the process: http://blog.thoughtram.io/angular2/2015/11/23/multi-providers-in-angular-2.html

EDIT:I consider this less of a concern now since components are declared at the module level. This means a lot less repetition since you no longer have to declare child components at the individual component level.