我使用Angular2Angular2表单页面重新加载?
无法弄清楚为什么页面refereshing:
我的表格:
<form>
<div class="form-group">
<label class="form-label">Username</label>
<input type="email" class="form-control" id="username" placeholder="Email" name="username" />
</div>
<div class="form-group">
<label class="form-label">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" name="password" />
</div>
<input type="submit" class="btn btn-primary mr-3" (click)=onSubmit() />
</form>
在TS:
import { Component} from '@angular/core';
声明变量$:任何; declare var jQuery:any;
@Component({ 选择: '猫页面', templateUrl: './login-alpha.html' })
出口类PagesLoginAlpha {
onSubmit()
{
console.log("in submittt");
}
}
上点击功能用引号'(点击)= “的onsubmit()”' – mxr7350
没有现在也是其重装。 –