I am currently incorporating Angular2 into my project.
I am facing an issue where the page keeps refreshing, and I'm unable to determine the cause.
Below is a snippet of my form:
<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>
In TypeScript file:
import { Component} from '@angular/core';
Declare jQuery variables:
declare var $: any; declare var jQuery: any;
@Component({ selector: 'cat-page', templateUrl: './login-alpha.html' })
Exporting PagesLoginAlpha class:
onSubmit()
{
console.log("in submittt");
}
}