$http.get('/GetData').then(function(response) {
$scope.lastTimeStamp = response.data.result[1].timestamp;
var timeStamp = moment($scope.lastTimeStamp,"YYYY-MM-DD HH:mm:ss");
if($scope.lastTimeStamp!=undefined && $scope.lastTimeStamp!=''){
$scope.lastTimeStamp = $scope.lastTimeStamp;
} else {
$scope.lastTimeStamp = '';
}
}
So, This timeStamp value I want in another service call in different page.How I can call this timeStamp and display there?
I am not much friendly to coding..Please help.
for data sharing across the controller in angular JS
you can use localstorge, sessionstorage or $rootScope
way to share data through localstorage :
localStorage.setItem('title', $scope.title);
// Retrieve the title
$scope.title = localStorage.getItem('title');
way to share data through sessionStorage:
sessionStorage.setItem(key, value);
// to get the data
sessionStorage.getItem(key, value);
way to share data through rootScope:
var app = angular.module("myApp", []);
app.run(function($rootScope) {
$rootScope.userData = {};
$rootScope.userData.firstName = "Ravi";
$rootScope.userData.lastName = "Sharma";
});
app.controller("firstController", function($scope, $rootScope) {
console.log($rootScope.userData.firstName)
});
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
How to array data extracted from this object Some Data ?
I have several PNG-logos (one solid color, solid black, solid white, black + color)I want to make one filter for all logos so that they are solid white
I am trying to get links or CSS value for current open screen not fully webpageI tried using XPath I also tried to fetch links on currently open screen but the syntax gives me all webpage links Is there any way out for this
I'm trying to remove the arrow from an angular material select componentTo do that I have a custom CSS file where I say display: none