lig*_*ter 10 angularjs ionic-framework
我是离子框架新手.我的数据来自sqlite结果.我可以先得到数据,这是我的数据结果,例如:
{title: "Test Title", content: "<p>Test hello</p>"}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
.controller('TestDetailCtrl', function($scope, $sce, $stateParams, SQLService) {
var content = '';
SQLService.get_one($stateParams.testId).then(function(res) {
content = res[0];
var test_data = {
title: content.title,
content: $sce.trustAsHtml(content.content)
};
$scope.test = test_data
});
})
Run Code Online (Sandbox Code Playgroud)
而我的观点
<ion-view view-title="{{test.title}}">
<ion-content class="padding">
{{test}}
<div ng-bind-html="test.content">{{test.content}}</div>
</ion-content>
</ion-view>
Run Code Online (Sandbox Code Playgroud)
我可以输出html内容,但我的标题没有显示,我尝试输出测试数据,我发现测试的内容键是空的.我不知道.谢谢你的帮助.
lig*_*ter 40
我尝试使用ion-nav-title
,这是工作.因为我的头衔是动态的.
<ion-view>
<ion-nav-title>{{test.title}}</ion-nav-title>
<ion-content class="padding">
{{test}}
<div ng-bind-html="test.content">{{test.content}}</div>
</ion-content>
</ion-view>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5706 次 |
最近记录: |