奇怪的问题,关于自定义函数使用
由于需要显示的内容是html格式,服务器返回是通过编码后的字符,为此在客户端需要再次反编译,因此在控制器中这样定义的controller('ChatsDetail', ['$scope', '$stateParams' ,'$Chats','InfoApi','$ionicLoading', function($scope, $stateParams, $Chats,InfoApi,$ionicLoading){
var decode=function(str){
return utf8to16(Xbase64decode(str));//utf8to16Xbase64decode是引入的外部JS函数
}
$scope.show = function() {
$ionicLoading.show(
{
template: '数据载入中...'
}
);
};
$scope.hide = function(){
$ionicLoading.hide();
};
var api = InfoApi.BoardDetail;
$scope.detailData = [];
$scope.show();
$Chats.findByID(api,{
ID:$stateParams.Id}
)
.success(function(data){
$scope.hide();
/* $scope.detailData=data.root; */
$scope.detailData.Title=data.root.Title;
$scope.detailData.Addtime=data.root.Addtime;
$scope.detailData.Content=decode(data.root.Content);
})
.error(function(){
$scope.hide();
});
}]);
这个在电脑上浏览,是可以正常显示,但是在打包成APP(安卓), $scope.detailData.Content内容没有显示出来?这个是什么原因?
1.检查你手机上面url可以不可以访问
2.看看有没有安装白名单插件 感觉不应该是跨域问题;
$scope.detailData.Title=data.root.Title;
$scope.detailData.Addtime=data.root.Addtime;
去掉这段////// $scope.detailData.Content=decode(data.root.Content);
$scope.detailData.Title
$scope.detailData.Addtime
可以正常显示出来
页:
[1]