douxianglu4370 2016-11-15 17:10
浏览 43

离子框架+ angularjs不显示重音字符

I have a form to create some folders (albums) to upload images. When I create an album with accented characters the accented characters are not displayed. For example: "Álbum" is displayed "lbum".

I am loading the albums on a list to further open the images according to each list item click. I don´t use database in this part of the app.

Is there a way to fix this in the app script? I tried to solve it using some examples like this one ($sce) but it did work.

I get this error when I try to usu it on response.data.

Error: [$sce:itype] Attempted to trust a non-string value in a content requiring a string: Context: html

list html

<ion-list id="fotos-list4" ng-show="albums_list">
        <ion-item class="item-icon-left item-icon-right calm no-border" id="fotos-list-item4" ng-model="album_name" ng-repeat="item in albums" item="item" href="#/item/{{item.FOLDER}}" ng-click="open_album(item)" ng-bind-html="trust">
            <i class="icon ion-images"></i>
                {{item.FOLDER}}
            <i class="icon ion-ios-arrow-forward"></i>
        </ion-item>
</ion-list>

controller

.controller('albumsCtrl', ['$scope', '$http', '$state', '$sce', function ($scope, $http, $state, $sce) {

  $http.get("http://website.com/dashboard/select-albuns.php").then(function(response){

    console.log(response);
    console.log(JSON.stringify(response));

    $scope.albums = response.data;

    $scope.trust = $sce.trustAsHtml($scope.albums);

  }, function(response){

    $scope.albums_list = false;
    $scope.display_error = true;

  }).finally(function(){
    $scope.loading = false;
  });

...

php script

$path = "images";
$dirs = glob($path."/*", GLOB_ONLYDIR);

foreach($dirs as $dir){
    $reg = array(
     "FOLDER" => basename($dir).PHP_EOL
    );

    $return[] = $reg;
}

$return = json_encode($return);

echo $return;
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本