Issue
I would like to bind current date and time with a span,
<span id="lastUpdated" ng-bind="'loadMessage'"></span>
I returning the value of "loadMessage" from a function, but it's not working,
$scope.loadMessage = updateInfo();
function updateInfo() {
var today = new Date();
return "Last updated " + today.toLocaleString() + ".";
}
Solution
I'm assuming that you wanted to get date value at initial load only. You don't need to have '
(single qoute) around your ng-bind
expression so that it will take from $scope
<span id="lastUpdated" ng-bind="loadMessage"></span>
Answered By - Pankaj Parkar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.