Finalized the autocomplete component
This commit is contained in:
parent
b736d87b50
commit
000e1d53a8
|
@ -673,6 +673,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"angular2-uuid": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/angular2-uuid/-/angular2-uuid-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-cvA81TK39AAy6x7PufhFc4S+lW4="
|
||||||
|
},
|
||||||
"ansi-escapes": {
|
"ansi-escapes": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-2.0.0.tgz",
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"angular2-datatable": "^0.6.0",
|
"angular2-datatable": "^0.6.0",
|
||||||
"angular2-draggable": "^1.0.7",
|
"angular2-draggable": "^1.0.7",
|
||||||
"angular2-number-picker": "^0.8.8",
|
"angular2-number-picker": "^0.8.8",
|
||||||
|
"angular2-uuid": "^1.1.1",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"core-js": "^2.4.1",
|
"core-js": "^2.4.1",
|
||||||
"flat": "^4.0.0",
|
"flat": "^4.0.0",
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
<!--
|
<!--
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
<autocomplete-remote [id]="'test-autocomplete'" [label]="'Please select smth'" [url]="'https://eestore.paas2.uninett.no/api/datarepo/'" ></autocomplete-remote>
|
<autocomplete-remote [id]="'test-autocomplete'" [label]="'Please select smth'" [url]="'https://eestore.paas2.uninett.no/api/datarepo/'" ></autocomplete-remote>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -1,18 +1,5 @@
|
||||||
<!--
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
selectedValue: {{selectedValue}} <br>
|
<label *ngIf="label" for="{{id}}">{{label}}</label>
|
||||||
query: {{query}} <br>
|
|
||||||
<label for="{{id}}">{{label}}</label>
|
|
||||||
<select class="form-control" id="{{id}}" [ngModel]="selectedValue" (ngModelChange)="updateByQuery($event)" (change)="changed($event)">
|
|
||||||
<option *ngFor="let value of values; let i = index">{{value}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
selectedValue: {{selectedValue}} <br>
|
|
||||||
query: {{query}} <br>
|
|
||||||
<label for="{{id}}">{{label}}</label>
|
|
||||||
<input auto-complete class="form-control" id="{{id}}" [ngModel]="selectedValue" (ngModelChange)="updateByQuery($event)" [source]="values" />
|
<input auto-complete class="form-control" id="{{id}}" [ngModel]="selectedValue" (ngModelChange)="updateByQuery($event)" [source]="values" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, OnInit,Input, Output, EventEmitter} from '@angular/core';
|
import { Component, OnInit,Input, Output, EventEmitter} from '@angular/core';
|
||||||
import { ServerService } from '../../../services/server.service';
|
import { ServerService } from '../../../services/server.service';
|
||||||
|
import { UUID } from 'angular2-uuid';
|
||||||
import { NguiAutoCompleteModule } from '@ngui/auto-complete';
|
import { NguiAutoCompleteModule } from '@ngui/auto-complete';
|
||||||
|
|
||||||
declare var $: any;
|
declare var $: any;
|
||||||
|
@ -30,6 +30,8 @@ export class AutocompleteRemoteComponent implements OnInit {
|
||||||
query : string = "";
|
query : string = "";
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
if(this.id == null)
|
||||||
|
this.id = UUID.UUID();
|
||||||
this.updateByQuery(this.query); //just to trigger the first call
|
this.updateByQuery(this.query); //just to trigger the first call
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue