2017-05-05 21 views
0

私はunicodeデータを返すPHPでapiを作成しました。Ionic/Angular JSでUnicode文字を表示できません

echo(json_encode($ary, JSON_UNESCAPED_UNICODE)); 

?????を返しますが、受信後にアンドロイドに正しくデータを表示します。 しかし、イオンはそれを表示しません。 何が問題なのでしょうか。

答えて

0

あなたは、

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

 
mOverview.controller('mOverviewController', function ($scope, $sce) { 
 
    $scope.mData = [ 
 
    { 
 
     'name': '↓ '+'NASDAQ', // here the unicode is ↓ but the output is also ↓ which is supposed to be a down-arrow 
 
     'amount': '15,698.85', 
 
     'upDown': '+105.84' 
 
     } 
 
    ]; 
 
}); 
 

 
mOverview.filter('unsafe', function($sce) { 
 
    return function(val) { 
 
     return $sce.trustAsHtml(val); 
 
    }; 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.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>{{md.amount}}</td> 
 
     <td>{{md.upDown}}</td> 
 
     </tr> 
 
    </table> 
 
</div>

以下のサンプルを参照してください$のSCE(厳密コンテキストエスケープ)を使用する必要があります
関連する問題