What do I need to do to keep the message updated when changing the LastMessage? Thank you in advance.
angular.module('myApp',[]).controller('MessageController', function($scope) {
getMessage = function(x){
return "Hello, " + x + ":)";
}
$scope.lastMessage = "StackOverflow";
$scope.message = getMessage($scope.lastMessage);
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myApp">
<div ng-controller="MessageController">
<input type="text" ng-model="lastMessage" ng-model-options="{allowInvalid: true}">
<p ng-bind="lastMessage"></p>
<p ng-bind="message"></p>
</div>
</body>