My Angular coding is rusty as I haven't done it in a while but what I am trying to do is take a list of values returned from a list controller and inject them into my Response post to a search controller that will use this list to search a repository.
This is what I have tried so far--
1 - initialize the list array with Guid:[] in the $scope.data{} initializer
//Initailize
$scope.data = {
selection: null,
start: '',
end: '',
minDate: new Date(2017, 01, 01),
defaultStartDate: moment({ year: currentDate.getFullYear(), month: currentDate.getMonth(), day: currentDate.getDate() }),
defaultEndDate: moment({ year: currentDate.getFullYear(), month: currentDate.getMonth(), day: currentDate.getDate() + 1 }),
format: 'YYYY-MM-DD HH:mm:ss.SSS',
elasticUrl: '',
dnsHost: '',
messageTypes: [],
scrollId: '',
TID: '',
Guids: []
};
2 - return the list that I am interested in from a search controller with $scope.Guids = data.Guids
var search = function () {
NProgress.start();
var ospLogsSearchParam = {
StartDate: $scope.data.start,
EndDate: $scope.data.end,
ElasticUrl: $scope.data.elasticUrl,
MessageTypes: $scope.data.messageTypes,
DnsHost: $scope.data.dnsHost,
TID: $scope.data.TID,
};
var queryString = $.param(ospLogsSearchParam);
$http.get("/api/search?" + queryString).success(function (data) {
$scope.isLoading = false;
$scope.total = data.Total;
$scope.took = "";
$scope.tookMins = "";
$scope.successCount = "";
$scope.errorCount = "";
$scope.tps = "";
$scope.Guids = data.Guids; (data list)
}).finally(function () {
NProgress.done();
});
}
3 - inject this value (Guids: $scope.data.Guids) into the Guids field in the SearchParameter object that I am sending a second search controller.
function invokeParse() {
var ospLogsSearchParam = {
StartDate: $scope.data.start,
EndDate: $scope.data.end,
ElasticUrl: $scope.data.elasticUrl,
MessageTypes: $scope.data.messageTypes,
DnsHost: $scope.data.dnsHost,
TID: $scope.data.TID,
Guids: $scope.data.Guids (data trying to send to back end controller)
};
var parse = {
Logs: $scope.filteredItems,
DNSName: !$scope.data.dnsHost ? 'none' : $scope.data.dnsHost,
OspLogsSearchParams: ospLogsSearchParam
}
Expected result is that the back end search controller will perform a search using each value in the list as the where filter.
Actual result is that the guid list is not being populated with that values from the search request.