我已经被这个问题困扰了一段时间了。当我在不同的子页面之间导航时,离子内容得到了很好的更新但是在我重新加载页面之前标题内容没有显示任何内容(使用网页浏览器),我认为它没有意义,因为我想制作一个移动应用程序。我正在动态加载内容(通过HTTP GET)
在我的一个观点中,我有以下
<ion-view cache-view="false">
<ion-nav-buttons side="right">
<button class="button button-icon icon ion-chevron-right"></button>
<ion-nav-buttons>
<ion-nav-buttons side="left">
<button class="button button-icon icon ion-chevron-left"></button>
<ion-nav-buttons>
<ion-nav-title>
<h1>{{header.title}}</h1>
</ion-nav-title>
<ion-content>
<ul class="list">
<li class="item item-checkbox" ng-repeat="item in list">
<label class="checkbox"> <input type="checkbox" ng-click="selectcategories(item.id)"
ng-checked="selection.indexOf(item.id) > -1"></label>
{{ item.catname |uppercase}}
</li>
</ul>
</ion-content>
</ion-view>
在上述视图的控制器中,我有
app.controller('usercategoryController',
function($scope,getcategories,$log)
{
$log.info("userCategoryController Called ...");
$scope.list=getcategories;
$scope.header={};
$scope.header.title="Categories";
});
我的应用配置是:
app.config(['$stateProvider','$urlRouterProvider',
function($stateProvider,$urlRouterProvider)
{
$stateProvider
state('user',{
abstract:true,
url:"/user",
templateUrl:'views/user.html',
}).state('user.categories',{
url:"/categories",
templateUrl:'views/categories.html',
controller: 'usercategoryController',
resolve:{
getcategories: function(userService) {
return userService.getcategories();
}
},
})
$urlRouterProvider.otherwise('/user');
}
]);
这是我的抽象视图
<ion-nav-bar class="bar bar-header bar-positive">
</ion-nav-bar>
<ion-nav-view animation="slide-left-right"></ion-nav-view>
它总是会显示一个没有内容的蓝色标题,直到我重新加载浏览器。对于标题标题,我尝试了title和view-title属性,但没有成功。
如果有人有解决方案,请告诉我
答案 0 :(得分: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>
和内部&#34;离子含量&#34; -
<div class="row>
<textarea placeholder="" rows="3" maxlength="100" ng-model="$root.Title" ng-trim="false"></textarea>
</div>
否则只需使用ng-if =&#34; Title&#34;在标题栏中将无法正常工作。不确定这是否适用于您的情况,但我希望它至少可以以某种方式帮助。欢呼声。