Tengo una función setServiceId(serviceId) la que se llama haciendo clic en algún botón y estoy pasando la identificación de ese servicio.
También tengo serviceIdSubscrier = vm.selectedServiceId.supsendableSubscribe(changeServiceId) que escucha en cada cambio de serviceId (por ejemplo, si hice clic en id = 5151, y luego en 5152, este evento se activará y se llamará a una función changeServiceId ) Sin embargo, ahora, Quiero que cuando haga clic varias veces en el mismo servicio, también se active, ya que se activaría cuando las identificaciones son diferentes (por ejemplo, hice clic en la identificación del servicio = 5151, y luego nuevamente en la identificación = 5151) y me gustaría tener el mismo comportamiento ya que hice clic en diferentes identificaciones
estas son todas mis funciones:
function setServiceId(serviceId) { vm.selectedServiceId(serviceId); jQuery.post(rootUrl + 'spaemployeeadmin/GetFirstSearchFilterDateForParent', { locationId: vm.selectedLocationId() }) .done(function (data) { var dateObj = { day: data.Day, month: data.Month, year: data.Year }; vm.refreshData(dateObj, null); }); } serviceIdSubscrier = vm.selectedServiceId.supsendableSubscribe(changeServiceId)
function changeServiceId() { var currentService = getService(); if (vm.combineSchedules()) { vm.selectedService(currentService || {}); refreshAllowedTimes().then(function () { setTimeByPreviousSelection(); checkToPushCriteria(); }); } else { refreshOnServiceType(); } }Si serviceId fuera un objeto, podría cambiarlo a otro objeto con los mismos valores y se registraría un cambio.
5 === 5 //True {id: 5} === {id: 5} //False