大家好:
我想在我的项目中添加jquery_lazyload
依赖项:
“angular2”:“2.0.0-beta.3”,
“jquery-lazyload”:“1.9.7”
html代码:
<div *ngFor="#page of pages">
<img class="lazy" data-original="http://i-digi-sign.appspot.com{{page}}.jpg" width="595" height="842">
</div>
但它抛出异常:
Error: Template parse errors:
Can't bind to 'original' since it isn't a known native property (""595" height="842" style="margin-top: 10px;">-->
<img class="lazy" [ERROR ->]data-original="http://i-digi-sign.appspot.com{{page}}.jpg" width="595" height="842" style="margin-top"): TemplateEditComponent<strong i="15">@76</strong>:50
at new BaseException (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2.dev.js:7325:21)
at TemplateParser.parse (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2.dev.js:23440:15)
at http://127.0.0.1:8888/node_modules/angular2/bundles/angular2.dev.js:24136:54
at Zone.run (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:1243:24)
at Zone.run (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2.dev.js:13408:32)
at zoneBoundFn (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:1220:26)
at lib$es6$promise$$internal$$tryCatch (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:468:17)
at lib$es6$promise$$internal$$invokeCallback (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:480:18)
at lib$es6$promise$$internal$$publish (http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:451:12)
at http://127.0.0.1:8888/node_modules/angular2/bundles/angular2-polyfills.js:123:10
如果我从 img.data-original 中删除“{{page}}”,代码将运行良好。
我该如何处理? 请帮我。
<img [attr.data-original]="expr">
见: https ://github.com/angular/angular/issues/4438
谢谢,它运作良好。
<img class="lazy" attr.data-original="http://i-digi-sign.appspot.com{{page}}.jpg" width="595" height="842">
...
最有用的评论
见: https ://github.com/angular/angular/issues/4438