Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic framework view-title not show [duplicate]

I'm ionic framework newbie. My data is come from sqlite result. I can get data first this is my data result, example:

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

This is my 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
  });
})

And my view

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

I can output the html content, but my title not show, and I try to output the test data, I found the test's content key is empty. I have no idea. Thanks your help.

like image 955
lighter Avatar asked Feb 10 '15 15:02

lighter


1 Answers

I try to use ion-nav-title, it's work. Because my title is dynamic.

<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>
like image 187
lighter Avatar answered Oct 10 '22 22:10

lighter