Hi Sander,

this is the ngcartitem.ts File who gives the Error..
you see some Problem in this Code?

import { Injectable,Input, Output, EventEmitter } from '@angular/core';
import { NgCartService} from '../ngcart/ngcart.service'



@Injectable()
export class NgCartItem   {
 
constructor(public id: number,
   public articleId: string,
   public name: string,
   public price: number,
   public quantity: string,
   public packagingUnit: number,
   public scaledPrice: number,
   public imagePath: string,
   public total: number,
   )  
{ }

public setId(id) {
   if (id) this.id = id;
   else {
       console.log('An ID must be provided');
   }
};

public getId() : number {
   return this.id;
}; 

public setArticleId(articleId) {
   if (articleId) this.articleId = articleId;
   else {
       console.log('An Article ID must be provided');
   }
};

public getArticleId() : string {
   return this.articleId;
}; 

public setName(name) {
   if (name) this.name = name;
   else {
       console.log('A name must be provided');
   }
}; 

public getName() : string{
   return this.name;
}; 

public setPrice = function (price) {
   let priceFloat = parseFloat(price);
   if (priceFloat) {
       if (priceFloat <= 0) {
           console.log('A price must be over 0');
       } else {
           this.price = (priceFloat);
       }
   } else {
       console.log('A price must be provided');
   }
};


public getPrice = function ()  {
   return this.price;
};


public setQuantity(quantity, relative) {
   let quantityInt = parseInt(quantity);
   let quantityOrg = parseInt(this.quantity);
   if (quantityInt % 1 === 0) {
       if (relative === true) {
           quantityOrg += quantityInt;
           this.quantity = quantityOrg.toString();

        if (quantityOrg >= this.packagingUnit) {
           this.setPrice(this.scaledPrice);
       }
       else {
           this.setPrice(this.price);
       }; 



        } else {
           quantityOrg = quantityInt;
           this.quantity = quantityOrg.toString();
       }
       if (quantityOrg < 1) quantityOrg = 1;
           this.quantity = quantityOrg.toString();
   } else {
       quantityOrg = 1;
       this.quantity = quantityOrg.toString();
       console.log('Quantity must be an integer and was defaulted to 1');
   }
};



public getQuantity(){
   return parseInt(this.quantity);
};

public setPackagingUnit(packagingUnit){
   if (packagingUnit) this.packagingUnit = packagingUnit;
}; 

public getPackagingUnit(){
   if (this.packagingUnit) return this.packagingUnit;
}; 

public setScaledPrice(scaledPrice){
   if (scaledPrice) this.scaledPrice = scaledPrice;
}; 

public getScaledPrice() {
   if (this.scaledPrice) return this.scaledPrice;
}; 

public setImagePath(imagePath){
   if (imagePath) this.imagePath = imagePath;
}; 

public getImagePath() : string{
   if (this.imagePath) return this.imagePath;
}; 

public getTotal(){
   return(this.getQuantity() * this.getPrice());
   //return parseFloat(""+this.getQuantity() * +this.getPrice()).toFixed(2);
   
}; 

public toObject(){
   return {
               id: this.getId(),
               articleId: this.getArticleId(),
               name: this.getName(),
               price: this.getPrice(),
               quantity: this.getQuantity(),
               packagingUnit: this.getPackagingUnit(),
               scaledPrice: this.getScaledPrice(),
               imagePath: this.getImagePath(),
               //total: parseFloat(""+this.getTotal()).toFixed(2) 
                total: parseFloat(this.getTotal().toFixed(2))    
       }
};
}



Am Freitag, 18. August 2017 11:29:35 UTC+2 schrieb Bernd Wachter:
>
> Hi,
>
> I have the following Problem when i Build my Angular 4 Project for 
> Production --prod
>
> I become always the following Error when i Build with ng build --prod
> ------------------------
>
> ERROR in Can't resolve all parameters for NgCartItem in 
> /Users/Benny/Projekte/ShopApp/src/app/ngcart/ngcartitem.ts: (?, ?, ?, ?, ?, 
> ?, ?, ?, ?).
> ERROR in ./src/main.ts
> Module not found: Error: Can't resolve 
> './$$_gendir/app/app.module.ngfactory' in 
> '/Users/Benny/Projekte/ShopApp/src'
> resolve './$$_gendir/app/app.module.ngfactory' in 
> '/Users/Benny/Projekte/ShopApp/src'
>  using description file: /Users/Benny/Projekte/ShopApp/package.json (relative 
> path: ./src)
>    Field 'browser' doesn't contain a valid alias configuration
>  after using description file: /Users/Benny/Projekte/ShopApp/package.json 
> (relative path: ./src)
>    using description file: /Users/Benny/Projekte/ShopApp/package.json 
> (relative path: ./src/$$_gendir/app/app.module.ngfactory)
>      no extension
>        Field 'browser' doesn't contain a valid alias configuration
>        /Users/Benny/Projekte/ShopApp/src/$$_gendir/app/app.module.ngfactory 
> doesn't exist
>
> but when i use: ng build --prod -aot=false
> then my Project Build works Ok
>
> only when i Build with ng build --prod
> then i become always this Error and my Project want not Build !
>
> have someone a Idea what is the Problem ???
>
> Thanks
> Benny
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to