JSFiddle - React, Tailwind, and code Playground

by arjunasuresh3

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.0-beta.3/angular-sanitize.js"></script>
<div ng-app="mOverview">
  <div ng-controller="mOverviewController">
    <table>
      <tr>
        <th></th>
        <th></th>
        <th></th>
      </tr>
      <tr ng-repeat="md in mData">
        <td ng-bind-html="md.name | unsafe"></td>
        <td><input type="text" ng-model="md.name"></td>
        <td>{{md.amount}}</td>
        <td>{{md.upDown}}</td>
      </tr>
    </table>
 </div>

JavaScript

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

mOverview.controller('mOverviewController', function ($scope, $sanitize, $sce) {
function decodeEntities(s){
    var str, temp= document.createElement('p');
    temp.innerHTML= s;
    str= temp.textContent || temp.innerText;
    temp=null;
    return str;
}
  $scope.mData = [
    {
        'name': '', // here the unicode is &darr; but the output is also &darr; which is supposed to be a down-arrow
        'amount': '15,698.85',
        'upDown': '+105.84'
        }
    ];
    $scope.mData[0].name = decodeEntities('&#163; NASDAQ');
});

mOverview.filter('unsafe', function($sce) {
    return function(val) {
        return $sce.trustAsHtml(val);
    };
});