Hello,
In fact, bad conception of my app. Just need to fit datetimepicker and the
$http request in the same controller, using a $watch to catch anychange to
the date.
Everything is synced now.
Thomas
var app = angular.module('app', ['ui.bootstrap']);
app.controller('DatepickerCtrl', function ($scope, $http) {
$scope.today = function () {
$scope.dt = new Date();
};
$scope.getdays = function () {
$http.get("getdays.php", {params: {j: $scope.dt.getTime
() / 1000}})
.success(function (response) {
$scope.vacations = response;
});
};
$scope.today();
$scope.getdays();
$scope.$watch('dt', function () {
$scope.getdays();
});
Le samedi 18 juillet 2015 15:02:52 UTC+2, Thomas Caramella a écrit :
>
> Hello,
>
> I'm newbie to AngularJS.
> I create 2 controllers : 1 to handle a datetimepicker, 1 to handle an
> $http request.
> I would like to create a binding as :
> - when a new date is choosen in the datetimepicker, r
> - refreshing the $http request, passing the new date as parameter, so the
> second controller is refreshed.
>
> Hope someone can help,
> Sincerely yours,
>
> Thomas
>
> Code : http://plnkr.co/edit/QzTMv0azLH1gm118O5jw?p=preview
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.