Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
Not able to run angular-cli command to build production

I have an Angular app, when I build this app in development environment (npm run build) it works completely fine.

But when I try to build with production tag, it fails with this error:

C:/Users/1234/app/src/$$_gendir/app/app.component.ngfactory.ts (617,85): Property 'router' is private and only accessible within class 'AppComponent'.

I know router is private (in below code), but how is it working fine for development instance, and none but AppComponent.html should be able to use that?

@Component({
    selector: 'my-app',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})

export class AppComponent {
    constructor(private router: Router, private _cookieService:CookieService) {
        //some function
    }
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Production build is stricter and thus doesn't let you access private objects outside of scope. You app.component.html will not be able to access router directly. You could write a public function in your app component and call the private router from within.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda