How can I replace HTTP with a simple string in angular.js?
I started working with Angular.js, I want to replace HTTP://
any url in a simple string like "hey", I didn't get any relevant solution. I would be grateful for your answer.
+3
abdulbarik
source
to share
2 answers
I got my answer, here is the controller code
function ListCtrl($scope, $http,Project) {
$http.get('/project').success(function(data){
for(var i=0;i<data.length;i++){
data[i].site=data[i].site.replace('http://','Hey');
}
$scope.projects=data;
});
+1
abdulbarik
source
to share
try it. http://www.w3schools.com/jsref/jsref_replace.asp
var str = "Visit Microsoft!";
var res = str.replace("Microsoft", "W3Schools");
+1
Naeem shaikh
source
to share