gpt4 book ai didi

angularjs - ionic 框架 View 标题未显示

转载 作者:行者123 更新时间:2023-12-04 02:32:37 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





AngularJS - (using Ionic framework) - data binding on header title not working

(12 个回答)


5年前关闭。




我是 ionic 框架新手。我的数据来自 sqlite 结果。我可以先获取数据这是我的数据结果,例如:

{title: "Test Title", content: "<p>Test hello</p>"}

这是我的 Controller
.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
});
})

而我的观点
<ion-view view-title="{{test.title}}">
<ion-content class="padding">
{{test}}
<div ng-bind-html="test.content">{{test.content}}</div>
</ion-content>
</ion-view>

我可以输出html内容,但是我的标题不显示,我尝试输出测试数据,我发现测试的内容键为空。我不知道。谢谢你的帮助。

最佳答案

我尝试使用 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>

关于angularjs - ionic 框架 View 标题未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28436072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com