I work in an Angular4 application where I want to process a range (enable / disable) based on a condition.
When there are no products in the basket, I want to disable the interval.
But when there is at least 1 product in the basket. Range will be included.

<span class=" notification-counter badge badge-danger" data-toggle="modal" data-target="#exampleModal" style="cursor: pointer;">{{nCount}}</span>
How can I handle this from HTML or typewriting ...
import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { DatePipe } from '@angular/common'; import { HostListener } from '@angular/core'; import {CartdataService} from './cartdata.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit{ nCount : string; constructor(private CartdataService:CartdataService,private http: HttpClient) { } ngOnInit() { this.CartdataService.cast.subscribe(Count=> this.nCount = Count); } }
source share