亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

angular ng 模塊驗證問題和 Laravel auth 密碼確認問題

angular ng 模塊驗證問題和 Laravel auth 密碼確認問題

PHP
守著一只汪 2022-12-11 09:35:21
當我在 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 回答

?
慕運維8079593

TA貢獻1876條經驗 獲得超5個贊

角度改變public error = [];public error = [] as any;現在可以工作?。?!



查看完整回答
反對 回復 2022-12-11
  • 1 回答
  • 0 關注
  • 145 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號