我使用离子宠物模板。 我有一个关于宠物详情页面的问题,如果我想在标题上有一个动态标题,它将不会显示任何内容,直到我重新加载页面(使用网页浏览器),但我认为它没有意义,因为我想制作一个应用程序。 我想念什么吗?我能做什么?
这是我的代码如下:
<ion-nav-bar class="bar-positive">
<div class="buttons" ng-controller="BackCtrl">
<a class="button button-icon icon ion-chevron-left" ng-click="$back()"></a>
</div>
<h1 class="title"> {{ current_pet.name }} </h1>
..
答案 0 :(得分:34)
如果您正在使用ion-view
,请使用此项:
<ion-nav-title>
{{ PageTitle }}
</ion-nav-title>
并将其放在ion-content
之外。
答案 1 :(得分:9)
在我的应用中,我用过这个:
<ion-view title="{{Properties.Title}}">
其中属性是我的范围内的对象(我有一种主控制器),我在每个“内部控制器”上“覆盖”。
答案 2 :(得分:0)
如果您正在使用并且只想在输入/ textarea填充(非空)时在标题栏中显示按钮,则可以执行以下操作。
<ion-header-bar class="bar-light">
<h1 class="title">{{$root.Title}}</h1>
<div class="buttons">
<button class="button button-clear icon ion-checkmark-round" ng-click="" ng-if="$root.Title"></button>
</div>
</ion-header-bar>
和“离子含量” -
<div class="row>
<textarea placeholder="" rows="3" maxlength="100" ng-model="$root.Title" ng-trim="false"></textarea>
</div>
否则只在标题栏中使用ng-if =“Title”将无效。