AngularJS data binding with expression

Angular data binding with the source as an expression

by Anand Mani Sankar

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<body ng-app="SampleMVCApp">
    <div ng-controller="SampleController">
         <h2>{{getText()}}</h2>
    </div>
</body>

JavaScript

angular.module("SampleMVCApp", [])
    .controller("SampleController", function ($scope) {
    $scope.getText = function(){
        return "Howzzaaatttt!";
    };
});