각도 응용 프로그램을 가지고 있는데,이 응용 프로그램을 개발 환경 (npm run build
)으로 빌드하면 완전히 작동합니다.생산을위한 각도 cli 명령을 실행할 수 없습니다.
하지만 생산 태그로 빌드 할 때,이 오류와 함께 실패 :
C:/Users/1234/app/src/$$_gendir/app/app.component.ngfactory.ts (617,85): Property 'router' is private and only accessible within class 'AppComponent'.
, 내가 라우터 (아래 코드에서) 개인 알지만, 그것은 개발 예를 들어 잘 작동하는 방법과 없음 하지만 AppComponent.html이이를 사용할 수 있어야합니까?
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(private router: Router, private _cookieService:CookieService) {
//some function
}
}
여기에보고 된 다른 문제 : https://github.com/angular/angular/issues/15451 – undefined
템플릿에서 직접 '라우터'에 액세스하십니까? – jonrsharpe
예 .. 템플릿에 직접 라우터를 사용하고 있습니다. app.component.html – undefined