var myApp = angular.module("myApp", []); myApp.controller("MainCtrl", function ($scope) { $scope.verse = 'The rich rules over the poor, and the borrower is the slave of the _____.'; $scope.reference = 'Proverbs 22:7'; $scope.correctAnswer = 'lender'; /* Function that checks if the answer was answered correctly. */ $scope.answeredCorrect = function () { return $scope.input === $scope.correctAnswer; } });
<body ng-app="myApp" ng-controller="MainCtrl"> <blockquote> <p>{{verse}}</p> <footer>{{reference}}</footer> </blockquote> <input class="form-control" ng-model="input" type="text"> <p class="text-success" ng-if="answeredCorrect()">Good job!</p> </body>