我正在尝试在英特尔XDK中创建一个角度应用程序,我有3页脚本在index.html中有3个单独的页脚。我需要的是当我运行每个页面时页脚和页脚消息将显示并隐藏每5个秒
app.js
app.controller('main', function ($scope,$interval,$ionicModal,localStorageService,$http,$q,$templateCache) {
$scope.showFooter =true;
$scope.footer_message ='Powered By';
$scope.checkConnection=function() {
var networkState = navigator.connection.type;
if(networkState == Connection.NONE){
$scope.footer_message = "No Network Connection";
return false;
}else{
$scope.footer_message = "Powered By";
return true;
}
}
$interval(function() {
if($scope.showFooter)
{
$scope.showFooter =false;
}
else{
$scope.showFooter =true;
}
},5000);
});
的index.html
我在index.html中有3页,有3页有3页单独的页面,如
<div class="bar bar-footer bar-balanced" style="background-color:#444444;">
<div class="title">{{footer_message}}</div>
</div>
答案 0 :(得分:0)
我试过这个例子,你需要添加ng-show来显示和隐藏数据更改的页脚。
var app = angular.module("app",[]);
app.controller('main', function ($scope,$interval) {
$scope.showFooter =true;
$scope.footer_message ='Powered By';
$interval(function() {
if($scope.showFooter)
{
$scope.showFooter =false;
console.log($scope.showFooter);
}
else{
$scope.showFooter =true;
console.log($scope.showFooter);
}
},5000);
});
根据要求更改showFooter值。
<div class="bar bar-footer bar-balanced" style="background-color:#444444;" ng-controller="main" ng-show="showFooter">
<div class="title">{{footer_message}}</div>
</div>