User1839056048 posted
Hi,
In my angular application ,there is 2 text boxes, username and password.
before connecting to backend i have tested the page with console.log but it is not firing
below the code
my .ts file
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-nav',
templateUrl: './nav.component.html',
styleUrls: ['./nav.component.css']
})
export class NavComponent implements OnInit {
model: any = {};
constructor() { }
ngOnInit() {
}
login() {
console.log(this.model);
}
}
net code for view
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Dating App</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Matches</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Lists</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Messages</a>
</li>
</ul>
<form #loginForm="ngForm" class="form-inline my-2 my-lg-0" ngSubmit="login()" >
<input class="form-control mr-sm-2" type="text" name="username" required [(ngModel)]="model.username">
<input class="form-control mr-sm-2" type="password" required name="password" [(ngModel)]="model.password">
<button class="btn btn-success my-2 my-sm-0" type="submit">Login</button>
</form>
</nav>
page is loading fine and no error displaying
and console.log is not firing
this is output
[WDS] Disconnected! client:196
Angular is running in the development mode. Call enableProdMode() to enable the production mode. core.js:3121
how to solve this
Regards
Baiju