AngularJs: Replace a part of a string

angularjs

Solution

your snippet works!

demo: http://plnkr.co/edit/yNuNeE5yO3rgKAYfGx48?p=preview

html

<body ng-app="app">
  <div>
    <div class="container" ng-controller="mainCtrl">
      <p>
      {{ name.replace('some', 'thing') }}
      </p>
    </div>
  </div>

</body>

js

var app = angular.module('app', []);


app.controller('mainCtrl',function($scope) {

    $scope.name = 'this is some';

  }
);

the output is `this is thing`

demo: http://plnkr.co/edit/yNuNeE5yO3rgKAYfGx48?p=preview

Problem

Is there a way in AngularJs to replace a string? I'm trying to do something like: ``` {{string.replace('some', 'thing')}} ``` Thanks!

Original source