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
There is no ng-init in Angular2. You can easily create such a directive yourself though.
ng-init
import { Directive, Input } from '@angular/core'; @Directive({ selector: '[ngInit]' }) export class NgInit { @Input() ngInit; ngOnInit() { if (this.ngInit) { this.ngInit(); } } }
and then use it like