I'm trying to set scope broadcasting in Angular. Datetimepicker should be defined in parent grid, children should inherit it. I tried this way:
$scope.dtBODStopValue = new Date()
$scope.dtBODStartValue = new Date(new Date(new Date().getTime() - 7 * MS_PER_DAY));
Changing Date/Time and broadcast to other grids
$scope.dateTimePickerBODStart = {
change: function () {
$scope.$broadcast(dtBODStartValue,dtBODStopValue);
$scope.OnGridRefresh();
}
};
$scope.dateTimePickerBODStop = {
change: function () {
$scope.$broadcast(dtBODStartValue,dtBODStopValue);
$scope.OnGridRefresh();
}
};
HTML:
<input kendo-date-time-picker="dateTimePickerBODStart" k-ng-model="dtBODStartValue" k-options="dateTimePickerBODStart"/>
<input kendo-date-time-picker="dateTimePickerBODStop" k-ng-model="dtBODStopValue" k-options="dateTimePickerBODStop"/>
as per documentation $broadcast is method of scope
$scope.$broadcast(name, args);
so in your case it should be
$scope.$broadcast('datepickerUpdate', dtBODStartValue, dtBODStopValue);
and then for listeners in child
scopes
$scope.$on('datapickerUpdate', function (event, dtBODStartValue, dtBODStopValue) {
//do stuff on change
})