Я создаю простое приложение с angular8, и я получаю эту ошибку, когда я использую модель для моего component.ts.Я не знаю, почему это происходит. Никто не может помочь мне решить эту проблему? Я делаю все классы без любое сообщение об ошибке. но когда я запускаю его в браузере. Ниже показано сообщение об ошибке
./src/app/test-form/test-form.component.ts 7:70
Module parse failed: Invalid number (7:70)
You may need an appropriate loader to handle this file type.
| constructor() {
| this.topics = ['Angular', 'React', 'Vue'];
> this.userModel = new User('galih', 'galihindra650@gmail.com', 082312514, '', 'morning', true);
| }
| ngOnInit() {
это мой код компонента
import { User } from '../model/user';
@Component({
selector: 'app-test-form',
templateUrl: './test-form.component.html',
styleUrls: ['./test-form.component.css']
})
export class TestFormComponent implements OnInit {
topics = ['Angular', 'React', 'Vue'];
userModel = new User('galih', 'galihindra650@gmail.com', 082312514, '', 'morning', true);
constructor() { }
ngOnInit() {
}
}
Класс пользователя
export class User {
constructor(
public name: string,
public email: string,
public phone: number,
public topic: string,
public timePreference: string,
public subscribe: boolean
) { }
}
HTML для компонента
<div class="container-fluid col-6">
<h3>Tes Form</h3>
<form #userForm="ngForm">
{{ userForm.value | json }} <br>User model : {{ userModel|json }}
<!-- <div ngModelGroup="address">
<div class="form-group">
<label>City</label>
<input type="text" required class="form-control" ngModel name="city">
<small class="text-danger">Name is required</small>
</div>
<div class="form-group">
<label> Street</label>
<input type="text" class="form-control" ngModel name="street">
</div>
</div> -->
<!-- Biar value setiam input bisa terbaca harus pake ngModel dan dikasih name -->
<div class="form-group">
<label>Name</label>
<input type="text" required class="form-control" [(ngModel)]="userModel.name" name="name">
<small class="text-danger">Name is required</small>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" [(ngModel)]="userModel.email" name="email">
. . .