Screen-1
This my first screen, there i am display all events and when user click on any events user goes to next screen which is given below
Screen-2
Here i got record from sqlite database. Please see url, url have id and in console also display record but in html record is not display if i refresh this page then its display proper but when i comes from screen 1 then its no display
I am use service for getting record from sqlite database
I just display console like this
.controller(‘EventDetailCtrl’, function($scope, $stateParams,Event)
{
console.log(“1”);
Event.get($stateParams.eventId).then(function(event)
{
console.log(“2”);
$scope.event = event;
});
console.log(“3”);
})
Its display 1 3 2. I not getting how its work. Please help me
try out $timeout or $scope.$apply to forcing redraw of the domelement when the promise.then is happen (after console.log(“3”))
.controller('EventDetailCtrl', function($scope, $stateParams,Event, $timeout)
{
console.log("1");
Event.get($stateParams.eventId).then(function(event)
{
console.log("2");
$timeout(function(){
$scope.event = event;
},0);
//or $scope.$apply(function(){$scope.event = event});
});
console.log("3");
})
Thanks but issue is in this directive. http://siddii.github.io i use this for calculating years ago and past years etc. any other directive you know??
maybe http://momentjs.com/ and https://github.com/icambron/moment-countdown is a nice thing for you, but never tried it by myself
$timeout works like charm…!! Thank you very much @Bastian