首页 > 解决方案 > (index):13 Uncaught ReferenceError: LoginUser is not defined at HTMLButtonElement.onclick

问题描述

<div class="clearfix">&nbsp;</div>
<div style="text-align: center">
<input #user matInput placeholder="username" type="text" name = "username" id="username">
<div class="clearfix">&nbsp;</div>
<input #pass matInput placeholder="password" type="password" name="password" id="password">
<div class="clearfix">&nbsp;</div>
<button onclick="LoginUser(user,pass)" class ="btn btn-primary" type ="submit" mat-raised-button >Click me!</button>
</div>

import { Component } from '@angular/core';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  
  LoginUser(user:HTMLInputElement,pass:HTMLInputElement) {
    console.log(user.value);
    console.log(pass.value);
   }


}

我正在使用 Angular 材料设计我无法在控制台上打印用户名和密码数据

标签: htmlangular

解决方案


推荐阅读