0

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;
Community
  • 1
  • 1
madsongr
  • 653
  • 1
  • 11
  • 29

0 Answers0