破坏MDL组件的angular2吸气剂

破坏MDL组件的angular2吸气剂,angular,getter-setter,material-design-lite,Angular,Getter Setter,Material Design Lite,所以,首先,我使用的是材料设计Lite,以防这与我的怪异问题有关 我有一个包含列表组件的页面 <my-list [list]="list"></my-list> 但当我将其更改为getter时(这样数据就会刷新,我的列表会显示最新的dynamicvare示例),我的开关就停止工作了 get list(): MyList{ return { items: [{ id: 'example-id', pr

所以,首先,我使用的是材料设计Lite,以防这与我的怪异问题有关

我有一个包含列表组件的页面

<my-list [list]="list"></my-list>
但当我将其更改为getter时(这样数据就会刷新,我的列表会显示最新的dynamicvare示例),我的开关就停止工作了

get list(): MyList{
    return {
        items: [{
            id: 'example-id',
            primaryContent: {
                title: 'Example Title',
            },
            secondaryContent: {
                toggle: {
                    id: 'example-toggle-id',
                    checked: this.dynamicVarExample,
                    type: 'switch'
                }
            }

        }]
    }
}

有人知道为什么会这样吗?似乎getter对事件做了一些事情。

在第一个示例中,
enter code here
在做什么?@birwin这是一个stackoverflow问题编辑器功能,但我不确定它为什么在那里-无论如何,我现在删除了这一行
list: MyList = {
    items: [{
        id: 'example-id',
        primaryContent: {
            title: 'Example Title',
        },
        secondaryContent: {
            toggle: {
                id: 'example-toggle-id',
                checked: this.dynamicVarExample,
                type: 'switch'
            }
        }
    }]
}
get list(): MyList{
    return {
        items: [{
            id: 'example-id',
            primaryContent: {
                title: 'Example Title',
            },
            secondaryContent: {
                toggle: {
                    id: 'example-toggle-id',
                    checked: this.dynamicVarExample,
                    type: 'switch'
                }
            }

        }]
    }
}