Call a function on click event in Angular 2
<p>How to declare a function inside a component (typescript) and call it on a click event in Angular 2?
Following is the code for the same functionality in Angular 1 for which I require Angular 2 code:</p>

<pre class="lang-html prettyprint-override"><code>&lt;button ng-click="myFunc()"&gt;&lt;/button&gt;
</code></pre>

<p>//controller</p>

<pre><code>app.controller('myCtrl', ['$scope', function($cope) {
    $scope.myFunc= {
        console.log("function called");
    };
}]);
</code></pre>