从Angular外部更改Angular2材质组件(例如,选择控制器)

时间:2017-10-24 09:09:54

标签: javascript angular

如果有可能......

我有一个网站:www.recognitiongame.com 我已经开始使用Angular2 Material Components(Autocomplete,Button ...)。

我想将“主题:”DropDownlist更改为Angular2 Material Select Component。

我有这个:

80-proxyexample.com:
  template_file: salt://apache/vhosts/redirect.tmpl
  ServerName: www.proxyexample.com
  ServerAlias: www.proxyexample.com
  RedirectSource: '/'
  RedirectTarget: 'https://www.proxyexample.com/'
  DocumentRoot: /var/www/proxy

443-proxyexample.com:
  template_file: salt://apache/vhosts/proxy.tmpl
  ServerName: www.proxyexample.com
  ServerAlias: www.proxyexample.com
  interface: '*'
  port: '443'
  DocumentRoot: /var/www/proxy

如何从外部访问Angular2 Component“selectedValue”变量? 像这样:

<mat-select placeholder="Main theme:" [(ngModel)]="selectedValue">
 <mat-option *ngFor="let maintheme of mainthemes" [value]="maintheme.id">
  {{ maintheme.value }}
</mat-option>   

1 个答案:

答案 0 :(得分:0)

public _selectedValue = window['selectedValue']
public set selectedValue(_selectedValue){
   this._selectedValue = _selectedValue;
   window['selectedValue'] = _selectedValue;
}

public get selectedValue(){
   return this._selectedValue;
}