Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/462.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 显示和隐藏页脚和页脚消息_Javascript_Angularjs_Intel Xdk - Fatal编程技术网

Javascript 显示和隐藏页脚和页脚消息

Javascript 显示和隐藏页脚和页脚消息,javascript,angularjs,intel-xdk,Javascript,Angularjs,Intel Xdk,我正在尝试使用Intel XDK创建一个角度应用程序。在这里,当我运行索引页时,我们可以看到页脚消息。 我需要的是页脚和页脚消息将显示和隐藏每5秒 index.html <div class="bar bar-footer bar-balanced" style="background-color:#444444;"> <div class="title">{{footer_message}}</div> </div>

我正在尝试使用Intel XDK创建一个角度应用程序。在这里,当我运行索引页时,我们可以看到页脚消息。 我需要的是页脚和页脚消息将显示和隐藏每5秒

index.html

<div class="bar bar-footer bar-balanced" style="background-color:#444444;">
            <div class="title">{{footer_message}}</div>
</div>

{{footer_message}}

您可以使用angular$interval或window.setInterval函数

$interval(function() {
if($scope.showFooter)
{
$scope.showFooter =false;
}
else{$scope.showFooter =true;}
},5000);
注意:您必须在控制器中注入$interval服务

在html中:

<div ng-show="showFooter" class="bar bar-footer bar-balanced" style="background-color:#444444;">
            <div class="title">{{footer_message}}</div>
</div>

{{footer_message}}

您可以使用$interval()在controller page和ng show in index page中,我认为您正在寻找foorter消息中的通知部分。因此,您可以做的是将消息变量绑定到$scope.$watch service中,并检查该变量是否有一些值,以及该消息是否有一些值立即执行null,并在html部分使用该变量的ng show

$timeout(function () {
            $scope.footerMessage = null;


        }, 2000);

... 或
window.setInterval
。。?那么<代码>摘要周期呢?我先尝试了$interval(),然后它就开始工作了。你的代码也在工作@RayonDabre@RayonDabre老实说我不知道,
code
digest cycle
code
是如何工作的。我一定会探讨这个话题。你能解释一下吗?还是请你摆弄一下@里沙布·贾因