当我在 Angular 前端创建错误消息时,它发生了这样的错误:属性“名称”在类型“任何[]”上不存在。甚至在输入电子邮件和密码时遇到问题。我为显示错误消息创建了空数组,但是当我要编译它时。将显示以下波纹管错误在此处输入图像描述<div class="form-group row"> <label for="inputName3" class="col-sm-3 col-form-label" >Name</label> <div class="col-sm-8"> <input type="text" name="name" class="form-control" id="inputName3" [(ngModel)]= "form.name" required> <div class="alert alert-danger" [hidden] = "!error.name"> {{error.name}} </div> </div> </div> public error = []; public form = { email: null, name: null, password: null, password_confimation: null };handleError(error) { this.error = error.error.errors;} onSubmit() { return this.http.post('http://localhost:8000/api/signup ', this.form).subscribe( data => console.log(data), error => this.handleError(error) );}Laravel 问题注册如果我输入正确的密码仍然显示需要输入匹配密码但是当我删除确认的部分时 'password'=> 'required'它工作正常。**User.php** public function setPasswordAttribute($value) { $this->attributes['password'] = bcrypt($value); }**AuthController.php** public function signup(SignUpRequest $request) { $user = User::create($request->all()); return $this->login($request); }**SignUpRequest.php** public function rules() { return [ 'name'=> 'required', 'email'=> 'required|email|unique:users', 'password'=> 'required|confirmed' ]; }
- 1 回答
- 0 关注
- 115 浏览
添加回答
举报
0/150
提交
取消