I am trying to create an OData filter in AngularJS that gets the variables passed from my view.
I am struggling with the concatenation. Especially with the start and end quotes ". I researched and tried various options like adding \ etc., but no luck.
The hard-coded filter would look like this:
$filter: "contains(ProductCode, 'GDN') and Price ge 5 and Price le 20"
Here is my filter using variables passed from the view:
var newFilter = "contains(ProductCode, " + "'" + vm.codeO + "')" + " and Price ge " + vm.priceGtO + " and Price le " + vm.priceLtO "\""
My filter using the variable must look exactly the same. Including the start and end quotes ".
Thank you in advance!