首页 > 解决方案 > 为 AngularJS 网站制作全屏加载图像

问题描述

我想在我的 AngularJS 网站完全引导之前显示全屏图像。

一种方法是使用ng-cloak.

这是显示一行单词的示例。

我尝试制作全屏图像

[ng-cloak].splash {
    /* The image used */
    background-image: url("https://media.thetab.com/blogs.dir/13/files/2017/02/nice-guy-2.jpg");

    /* Full height */
    height: 100%; 

    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

http://plnkr.co/edit/OTYwqGehVAsw5R8V?preview

但它没有用。有谁知道为什么?

标签: angularjsngcloak

解决方案


你错过display: block !important;[ng-cloak].splash

[ng-cloak].splash {
    /* The image used */
    background-image: url("https://media.thetab.com/blogs.dir/13/files/2017/02/nice-guy-2.jpg");

    /* Full height */
    height: 100%; 

    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: block !important;
}

http://plnkr.co/edit/oiGcMrO18nMt8KmM1d6X?preview&p=preview


推荐阅读