In angular1, we call the function ng-init based on ng-if condition. The following code represents If first div match with date && time then it will check the second
Working code,
Custom directive:
import { Directive, Input } from '@angular/core';
@Directive({ selector: '[myCondition]' })
export class ngInitDirective {
constructor() { }
@Input() set myCondition(condition: boolean) {
if (!condition) {
console.log("hello")
} else {
console.log("hi")
}
}
}
In template:
Play
pause