my url structure:
/json/feed?car=${cars}&colour=${color}&model=vw i want replace in ${} javascript var's have available (var cars, var colors, etc.), not sure how can angular.
would like:
$scope.newstring = oldstring.replace("${cars}","cars"); work ok, or there %s way of doing javascript ? better way angular?
replace variable instead of string.
$scope.newstring = oldstring.replace("${cars}",$scope.cars);
please take @ plunkr reference.
you can chain .replace's.
$scope.new = old.replace('${cars}', $scope.car).replace('${color}', $scope.color).replace('${model}', $scope.model);
Comments
Post a Comment