Daniel Dudas
Daniel Dudas

Reputation: 3002

Angular2: When I use minified (.min) version of js I am getting errors

I am using angular2 in plain javascript. I include this files:

<script type="text/javascript" src="libs/es6-shim/es6-shim.min.js"></script>
<script type="text/javascript" src="libs/es6-shim/shims_for_IE.js"></script>
<script type="text/javascript" src="libs/angular/2.0.0-beta.13/angular2-polyfills.js"></script>
<script type="text/javascript" src="libs/angular/2.0.0-beta.13/Rx.umd.js"></script>
<script type="text/javascript" src="libs/angular/2.0.0-beta.13/angular2-all.umd.js"></script>

When I change to include the minified version (.min) of last 3 to be like this:

<script type="text/javascript" src="libs/angular/2.0.0-beta.13/angular2-polyfills.min.js"></script>
<script type="text/javascript" src="libs/angular/2.0.0-beta.13/Rx.umd.min.js"></script>
<script type="text/javascript" src="libs/angular/2.0.0-beta.13/angular2-all.umd.min.js"></script>

I am getting this error:

EXCEPTION: TypeError: this.directive_1_0.ngDoCheck is not a function in [{'current-page': nav_selected=='search'} in class26@5:68]

The place where that error is triggered is in app.view.html

<router-outlet></router-outlet>

<!-- This is the menu -->
<nav id="menu">
    <a [routerLink]="['Search']" (click)="onNavItemClick('search')" [ngClass]="{'current-page': nav_selected=='search'}" id="search">Search</a>
    <a [routerLink]="['Results']" (click)="onNavItemClick('results')" [ngClass]="{'current-page': nav_selected=='results'}" id="results">Results</a>
</nav>

My bootstrap looks like this:

ng.core.enableProdMode();
ng.platform.browser.bootstrap(AppComponent,[
            ng.http.HTTP_PROVIDERS,
            ng.router.ROUTER_PROVIDERS,
            new ng.core.Provider(ng.router.LocationStrategy, {useClass: ng.router.HashLocationStrategy})
]);

If I just remove .min from angular2-all.umd.min.js file I don't have any error.

Also If I remove this 2 lines from app.view.html I am getting other error:

EXCEPTION: Error: Uncaught (in promise): No Directive annotation found on t

I am doing something wrong that is working only on non minified files? Or should I do something to work on min files?

EDIT 8 Apr 2015 The problem is still here in 2.0.0-beta.14

Upvotes: 0

Views: 351

Answers (2)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657721

update

fixed in beta.16

original

This is a known issue with minified versions of the files

Actually there are lot of different related issues reported

https://github.com/angular/angular/search?q=minified&type=Issues&utf8=%E2%9C%93

Upvotes: 1

Thierry Templier
Thierry Templier

Reputation: 202256

There are some opened issues regarding this problem in the Angular2 github repository.

Here is the one regarding the ngDoCheck function:

Upvotes: 1

Related Questions