html - (index):13 Uncaught ReferenceError: LoginUser is not defined at HTMLButtonElement.onclick
问题描述
<div class="clearfix"> </div>
<div style="text-align: center">
<input #user matInput placeholder="username" type="text" name = "username" id="username">
<div class="clearfix"> </div>
<input #pass matInput placeholder="password" type="password" name="password" id="password">
<div class="clearfix"> </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 材料设计我无法在控制台上打印用户名和密码数据
解决方案
推荐阅读
- c# - 'Ref' 和 'Out' 参数的内存分配,有什么区别吗?
- mysql - Why type data "long blob" in mysql read as "int8" in data explorer MATLAB?
- javascript - Gatsby v2 项目中的缓存问题
- ibm-cloud - 在没有 procfile 的 IBM Bluemix 上部署非 Web 应用程序 (python)?
- android - Ctrl + C vs Ctrl + Z for pausing repo sync?
- r - 使用公式(而不是函数)指定 map2() 的选项
- java - 在云环境中,使用哪些技术让客户端上传要处理的文件的好方法是什么?
- mysql - 插入选择语句
- javascript - 错误类型错误:无法在 Angular 6 中读取 null 的属性“推送”
- java - 在 Android 上禁用 Firebase 离线功能