我需要使用绑定将值数组传递给组件,例如
@Component({
selector: 'my-component',
template: '<div data="[1, 2, 'test']"></div>
})
export class MyComponent {
@Input() data: any[];
...
}
Run Code Online (Sandbox Code Playgroud)
但是,似乎Angular将其视为string/ string[1](在实际项目中,数组是一个路由,我需要将此路由传递给具有该[routerLink]指令的组件).
我该怎么做?