I am attempting to display a default message on a textarea using AngularJS. Some of the values I want to include require the use of $timeout
to retrieve the values.
The message does not appear to show up with the following code:
<textarea class="text-input referral-message" ng-init="message=buildMessage(purchase_count)"
ng-model="message" rows="5">
</textarea>
$timeout(function() {
ReferralService.settings().$promise.then(function(settings) {
$scope.purchase_count = settings.credits;
});
$scope.buildMessage = function(val){
return "Purchase " + val + " and receive 1 free with each purchase"
}
}, 1);