Using ngForm in html form but getting error

I have created an component called login and created a html form login.component.html then I wanted to make this form as Angular form. So I added <form #loginform="ngForm"> in login.component.html and import import {NgForm} from ‘@angular/forms’ in login.component.ts. Can you help me where is the issue? I already tried import { FormsModule } from ‘@angular/forms’; but still not working.

So when I run the server I get an error said:

  ERROR in src/app/login/login.component.html:2:23 - error NG8003: No directive found with exportAs 'ngForm'.
    2     <form #loginform="ngForm">
        6   templateUrl: './login.component.html',
        Error occurs in the template of component LoginComponent.


import { Component, OnInit } from '@angular/core';
import {NgForm} from '@angular/forms';

  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
export class LoginComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {



<div class="container">
    <form #loginform="ngForm">
      <div class="form-group">
        <label for="email">Email:</label>
        <input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
      <div class="form-group">
        <label for="pwd">Password:</label>
        <input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd">
      <div class="checkbox">
        <label><input type="checkbox" name="remember"> Remember me</label>
      <button type="submit" class="btn btn-default">Login</button>

Source: Angular Questions