My Technical Notes

Thursday, 20 August 2015

ng-click for Button Events

Angular Logic


var app = angular.module('app', []);

app.controller('ctrl', function ($scope) {
    $scope.buttonClick = function () {
        alert('hello');
    }
});

HTML


<div ng-app="app" ng-controller="ctrl">
    <button ng-click="buttonClick()">Button</button>
</div>

No comments: