【问题标题】:Passing an object from an Angular 2 component to a custom directive将对象从 Angular 2 组件传递到自定义指令
【发布时间】:2021-10-30 06:58:12
【问题描述】:

我必须将 angular 2 组件中的地图(不是原语 - 可以正常工作)传递到自定义指令中,但只需不断获取字符串 - “[object Map]”

TS:

differences : Map<string,ObjectDifference>

HTML:

<input  type='text' differences={{differences}}> // I feel that's where the problem is

指令代码:

@Input('differences') differences : Map<string,ObjectDifference> 

运行时指令中的值:

differences: "[object Map]"

【问题讨论】:

标签: angular angular-directive


【解决方案1】:

当然,正确的 html 很简单:

[差异]="差异"

【讨论】:

    猜你喜欢
    • 2018-06-14
    • 2021-10-02
    • 1970-01-01
    • 2016-12-22
    • 1970-01-01
    • 2018-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多