[英]Missing title in Ionic ion-view
For some reason I cannot get the Ionic title to show up: http://codepen.io/hawkphil/pen/oXqgrZ?editors=101 出于某种原因,我无法获得Ionic标题: http : //codepen.io/hawkphil/pen/oXqgrZ?edit = 101
This code is not exactly 100% following Ionic example but I don't want to add 2 layers of state ( /
and /somethingelse
) just to do a simple page including top and bottom. 这个代码并不完全100%遵循Ionic示例,但我不想添加2层状态( /
和/somethingelse
)只是为了做一个简单的页面,包括顶部和底部。
HTML HTML
<ion-nav-bar class="bar-balanced">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="right">
<button class="button button-clear">
OK
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-view view-title="{{ title }}">
<ion-content class=" has-header">
test test
</<ion-content>
</ion-view>
JS JS
angular.module('ionicApp', ['ionic'])
.controller('MainCtrl', function($scope) {
$scope.title = '<b>BOLD TITLE</b>';
});
Is there a way to fix this? 有没有办法解决这个问题? I need a way to show dynamic title with HTML. 我需要一种用HTML显示动态标题的方法。
As you want to show view directly, independent of routing by ui-router
,then it should be ion-nav-view
instead of ion-nav
& then for changing nav
header ion-header-bar
, & then for binding HTML on the ion title you could use the answer suggest by @shushanthp. 由于你想直接显示视图,独立于ui-router
,那么它应该是ion-nav-view
而不是ion-nav
然后用于更改nav
标头ion-header-bar
,然后用于绑定离子上的HTML标题你可以使用@shushanthp建议的答案。
Code 码
<ion-nav-view view-title="{{ title }}">
<ion-header-bar align-title="left" class="bar-balanced bar">
<span ng-bind-html="title"></span>
</ion-header-bar>
<ion-content class=" has-header">
test test
</<ion-content>
</ion-nav-view>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.