Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.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
Angularjs 异步背景图像:url(…)和ng repeat_Angularjs_Asynchronous_Angularjs Ng Repeat - Fatal编程技术网

Angularjs 异步背景图像:url(…)和ng repeat

Angularjs 异步背景图像:url(…)和ng repeat,angularjs,asynchronous,angularjs-ng-repeat,Angularjs,Asynchronous,Angularjs Ng Repeat,假设我有一个API,它获取一个博客文章列表,每个文章都有自己的背景图像链接 <article ng-style="{'background-image': 'url({{ post.meta.cover }})'}" ng-repeat="post in blog.listOfPost"> 问题:在从api加载所有数据之前,我如何延迟解析html?如果您正在等待url,您只需检查它: <article ng-style="post.meta.cover ? {'backgro

假设我有一个API,它获取一个博客文章列表,每个文章都有自己的背景图像链接

<article ng-style="{'background-image': 'url({{ post.meta.cover }})'}" ng-repeat="post in blog.listOfPost">

问题:在从api加载所有数据之前,我如何延迟解析html?

如果您正在等待url,您只需检查它:

<article ng-style="post.meta.cover ? {'background-image': 'url(' + post.meta.cover + ')'} : {}" ng-repeat="post in blog.listOfPost">

<article ng-style="post.meta.cover ? {'background-image': 'url(' + post.meta.cover + ')'} : {}" ng-repeat="post in blog.listOfPost">