cosyhe 发表于 2016-10-10 16:57:32

ion-nav-bar动态刷新的问题

ion-nav-bar在加载第一次的时候设定了样式,是可以成功的,但是想在程序运行过程中,根据状态不同,改变ion-nav-bar的样式,始终都不行。我的html代码如下:<ion-view view-title="Dashboard">
<ion-nav-bar class="bar-{{headerStyle}}">
</ion-nav-bar>
<ion-content class="padding">
    <h2>Welcome to Ionic:{{headerStyle}}</h2>
    <button class="button button-balanced" ng-click="Test()">myButton</button>
</ion-content>
</ion-view>

js代码如下:
.controller('DashCtrl', function($scope) {
$scope.headerStyle = "balanced";
$scope.Test = function(){
    $scope.headerStyle = "positive";
}
})

本想点击的时候,改变header的背景颜色,可是,点击动作之后,headerStyle的值确实变为了positive,可是头部的背景颜色没有改变?请问这是为什么?


页: [1]
查看完整版本: ion-nav-bar动态刷新的问题