相关疑难解决方法(0)

根指令上的Angular 2输入参数

示例显示如何在子组件上使用@Input()批注.我的问题是你如何在根组件上使用它?例如,如果您修改上面链接上的代码:

@Component({
selector: 'app',
template: `
    <bank-account bank-name="RBC" account-id="4747"></bank-account>
`,
directives: [BankAccount]
})
class App {
    @Input() something: string;
}

bootstrap(App);
Run Code Online (Sandbox Code Playgroud)

并在HTML中:

<app something="Test"></app>
Run Code Online (Sandbox Code Playgroud)

上面的示例永远不会更新App组件上的某些属性.

typescript angular2-template angular

14
推荐指数
2
解决办法
1万
查看次数

标签 统计

angular ×1

angular2-template ×1

typescript ×1