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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With