Commit 1dc716ed authored by nanahira's avatar nanahira

remve ngModel for currentServer

parent 4012759d
环境:
<mat-form-field appearance='standard'>
<mat-select [formControl]='ygopro.serverForm' [(ngModel)]='ygopro.currentServer'>
<mat-select [formControl]='ygopro.serverForm'>
<mat-option *ngFor='let server of ygopro.selectableServers' [value]='server'>
{{server.name}}
</mat-option>
......
......@@ -140,7 +140,13 @@ export class YGOProService {
serversPromise: Promise<Server[]>;
servers: Server[] = [];
selectableServers: Server[] = [];
currentServer: Server;
get currentServer(): Server {
return this.serverForm.value;
}
set currentServer(server: Server) {
this.serverForm.setValue(server);
}
constructor(private login: LoginService, private http: HttpClient, private dialog: MatDialog, private storage: StorageService) {
const app = this.http.get<App[]>('https://sapi.moecube.com:444/apps.json').pipe(
......@@ -253,8 +259,8 @@ export class YGOProService {
return condition(s);
});
if (!this.currentServer || !this.selectableServers.includes(this.currentServer)) {
this.currentServer = this.selectableServers[0];
this.serverForm.setValue(this.currentServer);
//this.currentServer = this.selectableServers[0];
this.serverForm.setValue(this.selectableServers[0]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment