angularjs - ionic 框架 View 标题未显示

标签 angularjs ionic-framework

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





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/

相关文章:

angularjs - 在 angularjs 应用程序中包含 tripadvisor 小部件

javascript - Angularjs Controller 与不同文件中的另一个 Controller 通信

ios - Ionic Cordova iOS xxx 不支持预配配置文件 Azure Pipelines

css - ionic 复选框内的 HTML 输入

ios - Ionic iOS 白色状态栏

javascript - 关于在 Angular JS 中创建矩阵表的建议

javascript - Angular JS 捕获服务器错误 Jsonp

angularjs - Ionic Cordova SQLite 插件错误无法读取未定义的属性 'openDatabase'

angularjs - Ionic 框架 - 检测互联网连接

javascript - Firebase 数组始终返回 false