In the input field specific id will be typed and saved inside searchText
:
<form class="input-group" ng-submit="getMainData()">
<input type="text" class="form-control" ng-model="searchText" placeholder=" Type KvK-nummer and Press Enter" id="typehead">
</form>
and when press enter it will get this function from the controller
$scope.getMainData = function(){
$http.get("http://localhost:8091/odata/dll-poc-dv/Account(':searchText')")
.success(function(data){
$scope.allData = data;
$scope.getData = $scope.allData.d.results;
});
};
What I want to achieve is the searchText
typed in the input to be passed as parameter inside the brackets (':searchText') of get the relevant data. A valid URL for getting the data looks like this: http://localhost:8091/odata/dll-poc-dv/Account('41-125061-0000')
Use +
operator for concatenation of variables. Also, use $scope.searchText
.
$http.get("http://localhost:8091/odata/dll-poc-dv/Account('" + $scope.searchText + "')")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.