I have search page , so user can search with firstname,lastname and email address. Whatever variable user passed to the factory i want to get the match result, so in below code if i pass one variable others are coming undefined, How to avoid this issue and use the get request ?
So far tried code...
main.html
<div class="row">
<div class="col-md-12">
<div class="col-md-3"> First / Last
Name :
</div>
<div class="col-md-3">
<input type="text" class="form-control" id="attestorFirstName" ng-model="attestorDTO.firstName" />
</div>
<div class="col-md-3">
<input type="text" class="form-control" id="attestorLastName" ng-model="attestorDTO.lastName" />
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-12">
<div class="col-md-3"> Email Address :
</div>
<div class="col-md-6">
<input type="text" class="form-control" id="attestorMail" ng-model="attestorDTO.emailId" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button class="btn btn-default pull-right" type="button" ng-click="searchAttestor()">
Search</button>
</div>
</div>
<div kendo-grid="attestorSearch" options="attestorSearchOptions" k-rebind="getAttestorSearchResultGrid"></div>
main.Ctrl
$scope.searchAttestor = function() {
$scope.searchresult = '';
$scope.attestorSearchOptions.dataSource = rcsaAssessmentService
.getOwnerSearchGridDataSource(
$scope.attestorDTO.firstName,
$scope.attestorDTO.lastName,
$scope.attestorDTO.emailId,
$scope.attestorDTO.nbkId);
$scope.getAttestorSearchResultGrid = new Date().getTime();
console.log("getting the response");
console.log($scope.attestorDTO.lastName);
};
mainFactory.js
getOwnerSearchGridDataSource : function(fName, lName,
mailId, nbkId) {
return new kendo.data.DataSource({
type : 'json',
transport : {
read : function(options) {
return $http.get(
'app/assessment/rest/ownerList?firstName=' +
fName + '&lastName=' +
lName + '&emailId=' +
mailId + '&nbkId=' +
nbkId).success(
function(data) {
options.success(data);
});
}
},
pageSize : 5,
schema : {
model : {
fields : {
fullName : {
editable : false
},
workEmailAddressText : {
editable : false
},
stdId : {
editable : false
}
}
},
}
});
},