小编dan*_*dan的帖子

picture element在angular2和firefox中不起作用

我有一个"徽标"组件,它基本上写出了一个图片元素.模板看起来像这样:

<picture class="logo">
<source srcset="{{srcsetMobile}}" media="(max-width: 767px)">
<source srcset="{{srcsetDesktop}}" media="(min-width: 768px)">
<img class="logo" title="{{title}}" alt="{{alt}}" src="{{fallbackSrc}}"
</picture>
Run Code Online (Sandbox Code Playgroud)

在angular2中产生

<picture _ngcontent-lox-3="" class="logo">
<source _ngcontent-lox-3="" media="(max-width: 767px)" ng-reflect-srcset="/assets/img/Logo-mobile.png" srcset="/assets/img/Logo-mobile.png"></source>
<source _ngcontent-lox-3="" media="(min-width: 768px)" ng-reflect-srcset="/assets/img/Logo.png" srcset="/assets/img/Logo.png"></source>
<img _ngcontent-lox-3="" class="logo" ng-reflect-title="title" title="title" ng-reflect-alt="alt text" alt="alt text" ng-reflect-src="/assets/img/Logo-mobile.png" src="/assets/img/Logo-mobile.png">
</picture>
Run Code Online (Sandbox Code Playgroud)

在Chrome中这很好用但在Firefox中只加载移动图片.标签在Angular之外加载很好.当我使用Web检查器并删除角度属性时,一切正常,所以我认为它是一个浏览器错误,但我想我会在这里发布,看看其他人是否有问题,或者有人有解决方法.

firefox picturefill angular

7
推荐指数
1
解决办法
1428
查看次数

回调函数上的Typescript错误:类型'Function'不提供签名匹配

我是一个错误,类型'功能'提供不匹配下面的过滤器的签名.这是真的,因为过滤器需要特定类型.如何定义我的回调以匹配过滤器所期望的?

private _getItemFilteredBy(itemName: string, Fn: Function): Observable<any[]> {
    return this.getItemByName(itemName)
        .map((items: any[]) => {
            return items.filter( Fn );
        });
}
Run Code Online (Sandbox Code Playgroud)

typescript

3
推荐指数
1
解决办法
2568
查看次数

标签 统计

angular ×1

firefox ×1

picturefill ×1

typescript ×1