title: Angular 2 Routerlink in for loop
body: <p>trying create Menu with below code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;aside id="left-panel"&gt;
   &lt;span class="minifyme"&gt; &lt;i class="fa fa-arrow-circle-left hit"&gt;&lt;/i&gt;
   &lt;/span&gt;
   &lt;nav&gt;
    &lt;ul&gt;
     &lt;li *ngFor="#menu of menus" [class.open]="menu === selectedMenu"
      (click)="onSelect(menu)"&gt;&lt;a [routerLink]="[menu.action]"&gt; &lt;i
       class={{menu.icon}}&gt;&lt;/i&gt; &lt;span class="menu-item-parent"&gt;{{menu.displayname}}&lt;/span&gt;
       &lt;b *ngIf="menu.childrens.length&gt;0"&gt; &lt;em class="fa"
        [ngClass]="{'fa-minus-square-o': menu === selectedMenu, 'fa-plus-square-o': menu !== selectedMenu}"&gt;&lt;/em&gt;
      &lt;/b&gt;
     &lt;/a&gt;
  
      &lt;ul *ngIf="menu.childrens" [class.show]="menu === selectedMenu"&gt;
       &lt;li *ngFor="#submenu of menu.childrens" (click)="onSelect(menu)"&gt;
        &lt;a&gt; {{submenu.displayname}} &lt;/a&gt;
       &lt;/li&gt;
      &lt;/ul&gt;&lt;/li&gt;
    &lt;/ul&gt;
   &lt;/nav&gt;
  &lt;/aside&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import {Component, OnInit} from 'angular2/core';
  import {Router} from 'angular2/router';
  import {RouteConfig,RouterLink, ROUTER_DIRECTIVES} from 'angular2/router';
  import {MenuService} from './menu.service';
  import {Menu} from './menu';
  
  
  @Component({
    selector: 'my-menu',
    templateUrl: 'app/menu/menu.component.html',
    directives: [ROUTER_DIRECTIVES,RouterLink,RouteConfig]
  })
  export class MenuComponent implements OnInit {
    public menus: Menu[];
      public selectedMenu: Menu;
     
      constructor(private _menuService: MenuService) { }
      getMenus() {
          this._menuService.getMenus().then(menus =&gt; this.menus = menus);
      }
      ngOnInit() {
          this.getMenus();
      }
       onSelect(menu: Menu) { this.selectedMenu = menu; }
  }
  
  Getting following error, please suggest</code></pre>
  </div>
  </div>
  </p>
  
  <p>EXCEPTION: No Directive annotation found on DecoratorFactoryBrowserDomAdapter.logError @ angular2.dev.js:23083
  angular2.dev.js:23083 STACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23083
  angular2.dev.js:23083 Error: No Directive annotation found on DecoratorFactory
      at new BaseException (<a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:7351:21" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:7351:21</a>)
      at DirectiveResolver.resolve (<a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:6654:13" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:6654:13</a>)
      at RuntimeMetadataResolver.getDirectiveMetadata (<a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22303:47" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22303:47</a>)
      at <a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22371:22" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22371:22</a>
      at Array.map (native)
      at Array.map (<a href="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js:10:16820" rel="noreferrer">https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js:10:16820</a>)
      at RuntimeMetadataResolver.getViewDirectivesMetadata (<a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22370:25" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:22370:25</a>)
      at TemplateCompiler._compileNestedComponentRuntime (<a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:24329:63" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:24329:63</a>)
      at <a href="https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:24314:26" rel="noreferrer">https://code.angularjs.org/2.0.0-beta.7/angular2.dev.js:24314:26</a>
      at Array.forEach (native)</p>