[英]Change Angular2 Material Component ( e.g. Select controller ) outside from Angular
If it is possible... 如果可能的话...
I have a site: www.recognitiongame.com I have started to use Angular2 Material Components ( Autocomplete, Button... ). 我有一个网站:www.recognitiongame.com我已经开始使用Angular2材质组件(Autocomplete,Button ...)。
I want to change the "Main theme:" DropDownlist to Angular2 Material Select Component. 我想将“主主题:” DropDownlist更改为Angular2材质选择组件。
I have this: 我有这个:
<mat-select placeholder="Main theme:" [(ngModel)]="selectedValue">
<mat-option *ngFor="let maintheme of mainthemes" [value]="maintheme.id">
{{ maintheme.value }}
</mat-option>
How can I access the Angular2 Component "selectedValue" variable from outside? 如何从外部访问Angular2组件的“ selectedValue”变量? Something like this: 像这样:
<html>
<body>
<my-app></my-app>
...
<script type="text/javascript">
**Change the selectedValue?**
</script>
</body>
</html>
public _selectedValue = window['selectedValue']
public set selectedValue(_selectedValue){
this._selectedValue = _selectedValue;
window['selectedValue'] = _selectedValue;
}
public get selectedValue(){
return this._selectedValue;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.