0
変数をinclude htmlページからmy appに渡したいと思います。Angular2 htmlページからappに変数を注入する
注:コンポーネント間を渡す方法は分かっていますが、質問はアプリ外からのものです!
例 私のhtmlページ:
<body>
<my-app customerId="123">Loading...</my-app>
</body>
と私は私のアプリで "はcustomerId" 変数を使用できるようにしたいです。
import {Component} 'angular2/core'からインポートします。
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent {
customerId;
}
これはどのようにすることができますか?
私は入力を試みましたが、成功しませんでした。
@Input("customerId") customerId;
ありがとう。