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


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


source


try it. http://www.w3schools.com/jsref/jsref_replace.asp



var str = "Visit Microsoft!";
var res = str.replace("Microsoft", "W3Schools");

      

+1


source







All Articles