Issue with AngularJS: Only One Line Displaying Instead of Both
I am encountering an issue with my AngularJS code where only one of the elements is displaying on my page.
function Today($scope, $timeout) {
$scope.now_time = 0;
(function update() {
$timeout(update, 1000);
var now = moment();
$scope.now_time = now.format("ddd, MMM Do, h:mm:ss a");
}());
}
function Yesterday($scope, $timeout) {
$scope.yst_date = 0;
(function update() {
$timeout(update, 1000);
var yst = moment().subtract('days', 1);
$scope.yst_date = yst.format("ddd, MMM Do");
}());
}
Within the HTML, I have implemented:
<div ng-app ng-controller="Today">{{now_time}}</div>
<div ng-app ng-controller="Yesterday">{{yst_date}}</div>
However, only the first now_time
element is appearing.
What adjustments should I make to ensure that both elements display correctly?