angular anchor directive

by Richard Hunter

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular.min.js"></script>
<h1>angular anchor directive </h1>
<div ng-controller="myctrl">
    <a href ng-click="doThis()">doThis</a>
    <p>Angular disables the default action of an anchor tag with no value for href. The default action being reloading the page</p>
    
</div>

JavaScript

angular.module('myapp', [])
.controller('myctrl', function($scope) {
    $scope.doThis = function () {
        console.log('do this');
    }
});

angular.bootstrap(document, ['myapp']);