Skip to content

Commit eddd1e5

Browse files
committed
Fix demo and docs
1 parent 8df572d commit eddd1e5

13 files changed

+40
-39
lines changed

angular.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"builder": "@angular-devkit/build-angular:application",
7272
"options": {
7373
"outputPath": {
74-
"base": "docs"
74+
"base": "docs",
75+
"browser": ""
7576
},
7677
"baseHref": "/auto-complete/",
7778
"index": "projects/demo/src/index.html",
File renamed without changes.

docs/browser/index.html docs/index.html

+2-2
Large diffs are not rendered by default.

docs/browser/main-SOUZ5HFM.js docs/main-MP7MFDPQ.js

+15-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.

projects/auto-complete/.eslintrc.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
],
1111
"parserOptions": {
1212
"project": [
13-
"projects/auto-complete/tsconfig.lib.json",
14-
"projects/auto-complete/tsconfig.spec.json"
13+
"./tsconfig.lib.json",
14+
"./tsconfig.spec.json"
1515
],
1616
"createDefaultProgram": true
1717
},

projects/demo/src/app/app.service.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export class AppService {
88
private marvelBase = 'http://gateway.marvel.com:80/v1/public/';
99
private marvelPublicKey = 'b9ced31de3874eb2c065a5bce26f8c59';
1010

11+
private googleMapsPublicKey = 'AIzaSyBjCWwFwEjaClobsRcY7mAlGSfCsRmD0Vg';
12+
1113
constructor(private _http: HttpClient) {
1214
}
1315

@@ -20,4 +22,8 @@ export class AppService {
2022
public findHeroes = (startsWith: string): Observable<any[]> => {
2123
return this._http.get<any>(`${this.marvelBase}characters?nameStartsWith=${startsWith}&apikey=${this.marvelPublicKey}`);
2224
};
25+
26+
public getMapsUrl = () => {
27+
return `https://maps.googleapis.com/maps/api/geocode/json?address=:my_own_keyword&key=${this.googleMapsPublicKey}`
28+
}
2329
}

projects/demo/src/app/component-test/component-test.component.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<legend><h2>Component test - multi autocomplete</h2></legend>
44
<div class="wrapper" (click)="showAutocomplete=true">
55
<li class="addr" *ngFor="let addr of addrs; let i = index;">
6-
<span>{{addr.formatted_address}}</span>
7-
<span class="remove" (click)="removeFromAddrs($event, i)">x</span>
6+
<span>{{ addr.formatted_address }}</span>
7+
<span class="remove" (click)="removeFromAddress($event, i)">x</span>
88
</li>
99

1010
<ngui-auto-complete
1111
*ngIf="showAutocomplete"
12-
(valueSelected)="addToAddrs($event)"
12+
(valueSelected)="addToAddress($event)"
1313
[accept-user-input]="true"
14-
[source]="googleGeoCode"
14+
[source]="appSvc.getMapsUrl()"
1515
display-property-name="formatted_address"
1616
[list-formatter]="myListFormatter"
1717
loading-text="Google Is Thinking..."

projects/demo/src/app/component-test/component-test.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component } from '@angular/core';
2+
import { AppService } from '../app.service';
23

34
@Component({
45
selector: 'app-component-test',
@@ -7,7 +8,6 @@ import { Component } from '@angular/core';
78
})
89
export class ComponentTestComponent {
910

10-
public googleGeoCode = 'https://maps.googleapis.com/maps/api/geocode/json?address=:my_own_keyword';
1111
public showAutocomplete = true;
1212
public loadingTemplate = '<h1>Loading h1</h1>';
1313
public addrs: any[] = [
@@ -28,7 +28,7 @@ export class ComponentTestComponent {
2828
*ngIf="showAutocomplete"
2929
(valueSelected)="addToAddrs($event)"
3030
[accept-user-input]="true"
31-
[source]="googleGeoCode"
31+
[source]="appSvc.getMapsUrl()"
3232
display-property-name="formatted_address"
3333
[list-formatter]="myListFormatter"
3434
loading-text="Google Is Thinking..."
@@ -54,15 +54,15 @@ export class ComponentTestComponent {
5454
</ngui-auto-complete>
5555
`;
5656

57-
constructor() {
57+
constructor(public appSvc: AppService) {
5858
}
5959

60-
public addToAddrs(addr: any): void {
60+
public addToAddress(addr: any): void {
6161
this.addrs.push(addr);
6262
this.showAutocomplete = false;
6363
}
6464

65-
public removeFromAddrs(evt, index: number): void {
65+
public removeFromAddress(event, index: number): void {
6666
this.addrs.splice(index, 1);
6767
event.stopPropagation();
6868
}

projects/demo/src/app/directive-test/directive-test.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h1> Autocomplete Directive Test - Local Source </h1>
6666
id="model4"
6767
[(ngModel)]="model4"
6868
placeholder="Enter Address(min. 2 chars)"
69-
[source]="googleGeoCode"
69+
[source]="appSvc.getMapsUrl()"
7070
no-match-found-text="No Match Found"
7171
list-formatter="formatted_address"
7272
path-to-data="results"
@@ -76,7 +76,7 @@ <h1> Autocomplete Directive Test - Local Source </h1>
7676
min-chars="2" />
7777
<br/>selected model4: {{model4 | json}}<br/><br/>
7878
<pre>{{template5}}</pre>
79-
<pre> source: {{googleGeoCode}}</pre>
79+
<pre> source: https://maps.googleapis.com/maps/api/geocode/json?address=:my_own_keyword</pre>
8080
</fieldset>
8181

8282
<fieldset><legend><h2>Source as Observable "Marvel API"</h2></legend>

projects/demo/src/app/directive-test/directive-test.component.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component, ViewEncapsulation } from '@angular/core';
2-
import { HttpClient } from '@angular/common/http';
32
import { AppService } from '../app.service';
43

54
@Component({
@@ -47,8 +46,6 @@ export class DirectiveTestComponent {
4746
{city: 'Dallas', state: 'Texas', nickname: 'The Big D', population: '1,317,929'},
4847
{city: 'San Jose', state: 'California', nickname: 'Capital of Silicon Valley', population: '1,025,350'}];
4948

50-
public googleGeoCode = 'https://maps.googleapis.com/maps/api/geocode/json?address=:my_own_keyword';
51-
5249
public model1 = 'is';
5350
public model2 = {id: 1, value: 'One'};
5451
public model3 = {key: 3, name: 'Key Three'};
@@ -194,10 +191,7 @@ export class DirectiveTestComponent {
194191
`;
195192

196193

197-
constructor(
198-
public appSvc: AppService,
199-
public http: HttpClient
200-
) {
194+
constructor(public appSvc: AppService) {
201195
}
202196

203197
public customCallback(text) {

projects/demo/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>Demo</title>
5+
<title>Angular auto-complete Showcase</title>
66
<base href="/">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<link rel="icon" type="image/x-icon" href="favicon.ico">

0 commit comments

Comments
 (0)