angularjs ng-init alternative in angular 2 or 4.
i written sample code of angularjs in below it working correctly but i want to same logic in angular 2 or 4.
calling the method via html if the condition is true.
sample.controller.js
$scope.showDiv = true;
$scope.callFunction = function() {
console.log("myFunction");
};
sample.html
<div ng-if="showDiv">
<div ng-init="callFunction()"></div>
</div>