Angular 7 : Build on prod : Property 'service' is private and only accessible within class Component
I am Using Angular 7. i run this cmd ng build --prod
build for protection.
That time i am caching this Error( Property 'service' is private and only accessible within class 'LoginComponent'):
ERROR in srcapploginlogin.component.html(5,33): : Property 'service' is private and only accessible within class 'LoginComponent'.
srcapploginlogin.component.html(18,104): : Property 'service' is private and only accessible within class 'LoginComponent'.
It's my HTML Code:
<div id=login_section class=d-flex justify-content-center align-items-center>
<div class=login_cnt col-8 row>
<div class=col-6 d-flex justify-content-center py-4>
<form class=col-8 [formGroup]=service.loginform>
<h2 class=text-center>User Login</h2>
<mat-form-field class=col-12>
<input matInput type=text placeholder=Username formControlName=username >
<mat-error>Username is Required</mat-error>
</mat-form-field>
<mat-form-field class=col-12>
<input matInput [type]=hide ? 'password' : 'text' formControlName=password placeholder=Password>
<mat-icon matSuffix (click)=hide = !hide>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
<mat-error>Password is Required</mat-error>
</mat-form-field>
<a href=# class=float-left lnk_forgot h7>Forgot Password</a>
<button mat-raised-button color=primary class=float-right [routerLink]=['/home'] [disabled]=service.loginform.invalid>Login</button>
</form>
</div>
</div>
</div>
It's My TS File:
import { Component, OnInit } from '@angular/core';
import { LoginService } from '../shared/login.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
username : string;
password: string;
hide = true;
constructor(private service: LoginService) { }
ngOnInit() {
}
}
when running ng serve am not catching it .