locked
code doesn't working properly in angular6 RRS feed

  • Question

  • 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

    Sunday, March 24, 2019 2:57 AM

All replies

  • User1724605321 posted

    Hi klbaiju ,

    I haven't met this issue before , but i searched related topic on Github, you could refer to below threads :

    https://github.com/angular/angular-cli/issues/11060 

    You may use try to disable host check as shown in above thread as a temporary workaround. Hope that helps .

    Best Regards,

    Nan Yu

    Monday, March 25, 2019 7:31 AM