PatrickJS-starter icon indicating copy to clipboard operation
PatrickJS-starter copied to clipboard

Routes in components (navbar) not working in prod

Open DocBradfordSoftware opened this issue 10 years ago • 3 comments

MyMenu Component

<nav  class="navbar navbar-light navbar-full" style="background-color: #e3f2fd; z-index: 999;">
  <ul  class="nav navbar-nav">
    <li class="nav-item" [ngClass]="{active: activeMenu == 'home'}">
      <a class="nav-link" [routerLink]="['Home']">Home</a>
    </li>
  </ul>
</nav>

<my-menu [activeMenu]="'home'"></my-menu>
<div class="container-fluid">
  <h4>Public View</h4>

  <p>bla bla bla</p>
</div>

This will work in dev mode, but not in prod Note: I have stripped out bootstrap and jquery, just normal css.

DocBradfordSoftware avatar Mar 11 '16 19:03 DocBradfordSoftware

I have added a repostitory that demonstrates this problem. This app will run in dev mode, but not in prod mode. angular2-webpack-starter-no-bs

DocBradfordSoftware avatar Mar 11 '16 23:03 DocBradfordSoftware

this is a problem with Angular 2. You will need to add all components/directives to the except mangle list (in this case add "TopMenu") https://github.com/mishoo/UglifyJS2/issues/999 https://github.com/angular/angular/issues/6678

PatrickJS avatar Mar 12 '16 05:03 PatrickJS

That makes perfect sense, Thanks

DocBradfordSoftware avatar Mar 12 '16 12:03 DocBradfordSoftware