<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材质设计 我无法在控制台上打印用户名和密码数据