jimmy
1
this is very simple question, but i don’t know why
when i change bookdatetime, but $scope.bookdatetime is not update value
view code
controller:
controller(‘SelectRentCtrl’, function($scope,$rootScope,remoteService,rentService,utilService) {
$scope.bookdatetime = utilService.today();
$scope.chooseStore = function(){
$rootScope.selectTools = rentService.selectTool($rootScope.toolList);
$rootScope.rentTool = rentService.rentTool($rootScope.toolList);
$rootScope.bookingDate = $scope.bookdatetime;
console.warn($scope.bookdatetime); >>> still old value
$rootScope.rentType = “story”;
}
})
Hey try manually checking the value returned by your utilService
service.
Something like:
var x = utileService.today();
console.log(x)
It is hard to read the rest of your code. Please edit your question in order to make it readable.
jimmy
3
$scope.bookdatetime = utilService.today(); >> 2014-08-26
$scope.dateChange = function(){
// change 2014-08-26 to 20-08-30, but bookdatetime still 2014-08-26
console.warn($scope.bookdatetime);
}
Sow your dateChange
function.
jimmy
5
dateChange function just let me debug.
my question is when i change the date , but $scope.bookdatetime still keep the old value
Sorry, I test in Chrome Browser.
Dbms
6
Check to see if you have designed the service correctly. This will help you get a better understanding in that case -
http://stsc3000.github.io/blog/2013/10/26/a-tale-of-frankenstein-and-binding-to-service-values-in-angular-dot-js/
jimmy
7
I resovled this question, but I still don’t know why
this work
$scope.bookdatetime = {};
$scope.book.bookdatetime = utilService.today();
this not work
$scope.bookdatetime = utilService.today();