Filter for replace text in Angular Js

filter
replace
angular js

By using below filter we will replace the text in angular js

angular.module('surgi')
.filter('ReplaceBreak', function() {
  return function(input) {
    input = input || '';
    html = '';
    var br_arr = input.split('<br>');
    for(var i=0;i<br_arr.length;i++){
    	html += br_arr[i]+', ';
    }
    html = html.substring(0, html.length - 2);
    html = html.replace(/,\s*$/, "");
    return html;
  };
});

 

 

 

You might also like:

Functions in javascript

25-05-2018 functions javascript es5 es6 arrow functions named functions Closures Nested Functions Callbacks Arrow functions.

How to insert bulk information into database in single query execution

18-03-2017 insert sql bulk database

How to use http-post request in node js

14-03-2017 http-post module node js

How to remove last / value from url in javascript

27-02-2017 array javascript last value

Get random strings from given string In javascript

21-02-2017 javascript random string