title: how to override directive definitions in angular 2
body: <p>It is possible in angular 1 to decorate (override) directive definitions.</p>
  
  <p>This is explained here: <a href="http://www.bennadel.com/blog/2926-overriding-directive-definitions-in-angularjs.htm">http://www.bennadel.com/blog/2926-overriding-directive-definitions-in-angularjs.htm</a></p>
  
  <p>There is a builtin function </p>
  
  <p><code>angular.module( "X" ).decorator(</code></p>
  
  <p>for this.</p>
  
  <p>In angular2 we don't have modules. The recommended way is to use typescript modules.</p>
  
  <p>How will it be possible to decorate(override) directives in angular2?</p>
  
  <p>The main reason i want to do this, is for customizations, when i deploy my app in a couple of sites.</p>
  
  <p>Let's say that i have a bundle.js with all my app, I want then just to drop in a customer.js with a bunch of customizations, instead of changing and rebuilding my existing bundle.js for every site deployment.</p>
  
  <p>Let's add a concrete example from the tour of heroes:
  I defined my app component in a javascript file:</p>
  
  <pre><code>import {Component, OnInit} from 'angular2/core';
  import {Hero} from './hero';
  import {HeroDetailComponent} from './hero-detail.component';
  import {HeroService} from './hero.service';
  
  @Component({
    selector: 'my-app',
    template:`
      &lt;h1&gt;{{title}}&lt;/h1&gt;
      &lt;h2&gt;My Heroes&lt;/h2&gt;
      &lt;ul class="heroes"&gt;
        &lt;li *ngFor="#hero of heroes"
          [class.selected]="hero === selectedHero"
          (click)="onSelect(hero)"&gt;
          &lt;span class="badge"&gt;{{hero.id}}&lt;/span&gt; {{hero.name}}
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;my-hero-detail [hero]="selectedHero"&gt;&lt;/my-hero-detail&gt;
    `,
  
    directives: [HeroDetailComponent],
    providers: [HeroService]
  })
  </code></pre>
  
  <p>I want to be able in another javascript file to switch the HeroDetailComponent with another component CustomHeroDetailComponent.</p>
  
  <p>How is this possible?</p>