I have an app that has an HTML drop down menu. The HTML drop down menu has three options. The three options relate to the time dimension in which data from a database is presented. Specifically, either data from the last hour can be presented, or from the last 30 minutes, or from the last 15 minutes.
The HTML code is as follows:
<select class="form-control input-sm">
<option value="1H" selected>Last Hour</option>
<option value="0.5H">Last 30 Mins</option>
<option value="0.25H">Last 15 Mins</option>
</select>
The corresponding JavaScript code is:
.factory('DataService', function ($http, $q, CONFIG, $filter, $timeout, $interval) {
var DataService = {};
var baseUrl = CONFIG.API_BASE_URL;
DataService.lastHour = function() {
return $http.get('/application/attack/from_time/3600');
}
}
Obviously, it is the case that the drop down menu does not work. Indeed, all data from the last hour is shown only, regardless of the option selected from the drop down menu (hence the "3600" in the HTTP GET request).
My question is how could this function and drop down menu be altered such that the previous 30 minutes will be shown only (changing 3600 to 1800 in the HTTP GET request) and the previous 15 minutes will be shown when selecting the option from the dropdown menu.
Many thanks.