相关疑难解决方法(0)

Angular 2数据属性

我觉得我错过了什么.当我尝试data attribute在我的中使用时template,像这样:

<ol class="viewer-nav">
    <li *ngFor="#section of sections" data-value="{{ section.value }}">
        {{ section.text }}
    </li>
</ol>
Run Code Online (Sandbox Code Playgroud)

Angular 2 崩溃:

EXCEPTION:模板解析错误:无法绑定到"sectionvalue",因为它不是已知的本机属性("

] data-sectionvalue ="{{section.value}}"> {{section.text}}

我显然遗漏了一些语法,请帮忙.

angular2-template angular

197
推荐指数
2
解决办法
10万
查看次数

ngx-translate:如何“翻译”一个 html 属性?

我已经在我的 Angular-Cli 应用程序中实现了 ngx-translate 并且在我执行以下操作时工作正常:

<div>{{ 'some.value' | translate }}</div>
Run Code Online (Sandbox Code Playgroud)

但是我该如何翻译 HTML 组件的属性呢?就像是:

<div data-text="{{ 'some.value' | translate }}"></div>
Run Code Online (Sandbox Code Playgroud)

(上面这段代码不起作用)

在此先感谢您提供的任何帮助...

JB

ngx-translate angular

3
推荐指数
2
解决办法
3666
查看次数

标签 统计

angular ×2

angular2-template ×1

ngx-translate ×1