1 | {"ast":null,"code":"import { City } from '../_models/city';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"../_services/city.service\";\nimport * as i2 from \"primeng/autocomplete\";\nimport * as i3 from \"@angular/forms\";\nimport * as i4 from \"@angular/common\";\nexport class ExploreComponent {\n constructor(cityService) {\n this.cityService = cityService;\n this.cities = [];\n this.filteredCountries = [];\n this.selectedCity = new City();\n this.text = '';\n }\n\n ngOnInit() {\n this.cityService.getAllCities().subscribe(cities => {\n this.cities = cities;\n });\n }\n\n search(event) {\n let filtered = [];\n let query = event.query;\n\n for (let i = 0; i < this.cities.length; i++) {\n let country = this.cities[i];\n\n if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\n filtered.push(country);\n }\n }\n\n this.filteredCountries = filtered;\n console.log(this.filteredCountries);\n }\n\n}\n\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) {\n return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService));\n};\n\nExploreComponent.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: ExploreComponent,\n selectors: [[\"app-explore\"]],\n decls: 19,\n vars: 5,\n consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [\"role\", \"main\", 2, \"background-color\", \"#F9F2E8\"], [1, \"bg-dark\", \"text-center\", \"text-white\"]],\n template: function ExploreComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"link\", 0);\n i0.ɵɵelementStart(1, \"html\", 1);\n i0.ɵɵelementStart(2, \"head\");\n i0.ɵɵelement(3, \"meta\", 2);\n i0.ɵɵelement(4, \"title\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(5, \"body\");\n i0.ɵɵelementStart(6, \"header\");\n i0.ɵɵelementStart(7, \"nav\", 3);\n i0.ɵɵelementStart(8, \"strong\", 4);\n i0.ɵɵtext(9, \"Trivia Trip\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(10, \"ul\", 5);\n i0.ɵɵelementStart(11, \"li\", 6);\n i0.ɵɵelementStart(12, \"p-autoComplete\", 7);\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_12_listener($event) {\n return ctx.text = $event;\n })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_12_listener($event) {\n return ctx.search($event);\n });\n i0.ɵɵpipe(13, \"async\");\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelement(14, \"li\", 6);\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n i0.ɵɵelementStart(15, \"main\", 8);\n i0.ɵɵtext(16, \" wfeefew \");\n i0.ɵɵelementEnd();\n i0.ɵɵelement(17, \"br\");\n i0.ɵɵelement(18, \"footer\", 9);\n i0.ɵɵelementEnd();\n i0.ɵɵelementEnd();\n }\n\n if (rf & 2) {\n i0.ɵɵadvance(12);\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", i0.ɵɵpipeBind1(13, 3, ctx.cities))(\"minLength\", 1);\n }\n },\n directives: [i2.AutoComplete, i3.NgControlStatus, i3.NgModel],\n pipes: [i4.AsyncPipe],\n styles: [\"\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MifQ== */\"]\n});","map":{"version":3,"sources":["C:/Users/DELL/Desktop/bachelor-thesis/trip-planner-front/src/app/explore/explore.component.ts"],"names":["City","i0","i1","i2","i3","i4","ExploreComponent","constructor","cityService","cities","filteredCountries","selectedCity","text","ngOnInit","getAllCities","subscribe","search","event","filtered","query","i","length","country","name","toLowerCase","indexOf","push","console","log","ɵfac","ExploreComponent_Factory","t","ɵɵdirectiveInject","CityService","ɵcmp","ɵɵdefineComponent","type","selectors","decls","vars","consts","template","ExploreComponent_Template","rf","ctx","ɵɵelement","ɵɵelementStart","ɵɵelementEnd","ɵɵtext","ɵɵlistener","ExploreComponent_Template_p_autoComplete_ngModelChange_12_listener","$event","ExploreComponent_Template_p_autoComplete_completeMethod_12_listener","ɵɵpipe","ɵɵadvance","ɵɵproperty","ɵɵpipeBind1","directives","AutoComplete","NgControlStatus","NgModel","pipes","AsyncPipe","styles"],"mappings":"AAAA,SAASA,IAAT,QAAqB,iBAArB;AACA,OAAO,KAAKC,EAAZ,MAAoB,eAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,2BAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,sBAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,gBAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,iBAApB;AACA,OAAO,MAAMC,gBAAN,CAAuB;AAC1BC,EAAAA,WAAW,CAACC,WAAD,EAAc;AACrB,SAAKA,WAAL,GAAmBA,WAAnB;AACA,SAAKC,MAAL,GAAc,EAAd;AACA,SAAKC,iBAAL,GAAyB,EAAzB;AACA,SAAKC,YAAL,GAAoB,IAAIX,IAAJ,EAApB;AACA,SAAKY,IAAL,GAAY,EAAZ;AACH;;AACDC,EAAAA,QAAQ,GAAG;AACP,SAAKL,WAAL,CAAiBM,YAAjB,GAAgCC,SAAhC,CAA0CN,MAAM,IAAI;AAChD,WAAKA,MAAL,GAAcA,MAAd;AACH,KAFD;AAGH;;AACDO,EAAAA,MAAM,CAACC,KAAD,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CAA3B;AACA5C,MAAAA,EAAE,CAAC8C,YAAH;AACA9C,MAAAA,EAAE,CAAC8C,YAAH;AACH;;AAAC,QAAIJ,EAAE,GAAG,CAAT,EAAY;AACV1C,MAAAA,EAAE,CAACqD,SAAH,CAAa,EAAb;AACArD,MAAAA,EAAE,CAACsD,UAAH,CAAc,SAAd,EAAyBX,GAAG,CAAChC,IAA7B,EAAmC,aAAnC,EAAkDX,EAAE,CAACuD,WAAH,CAAe,EAAf,EAAmB,CAAnB,EAAsBZ,GAAG,CAACnC,MAA1B,CAAlD,EAAqF,WAArF,EAAkG,CAAlG;AACH;AAAE,GAlCoD;AAkClDgD,EAAAA,UAAU,EAAE,CAACtD,EAAE,CAACuD,YAAJ,EAAkBtD,EAAE,CAACuD,eAArB,EAAsCvD,EAAE,CAACwD,OAAzC,CAlCsC;AAkCaC,EAAAA,KAAK,EAAE,CAACxD,EAAE,CAACyD,SAAJ,CAlCpB;AAkCoCC,EAAAA,MAAM,EAAE,CAAC,yKAAD;AAlC5C,CAArB,CAAtC","sourcesContent":["import { City } from '../_models/city';\r\nimport * as i0 from \"@angular/core\";\r\nimport * as i1 from \"../_services/city.service\";\r\nimport * as i2 from \"primeng/autocomplete\";\r\nimport * as i3 from \"@angular/forms\";\r\nimport * as i4 from \"@angular/common\";\r\nexport class ExploreComponent {\r\n constructor(cityService) {\r\n this.cityService = cityService;\r\n this.cities = [];\r\n this.filteredCountries = [];\r\n this.selectedCity = new City();\r\n this.text = '';\r\n }\r\n ngOnInit() {\r\n this.cityService.getAllCities().subscribe(cities => {\r\n this.cities = cities;\r\n });\r\n }\r\n search(event) {\r\n let filtered = [];\r\n let query = event.query;\r\n for (let i = 0; i < this.cities.length; i++) {\r\n let country = this.cities[i];\r\n if (country.name.toLowerCase().indexOf(query.toLowerCase()) == 0) {\r\n filtered.push(country);\r\n }\r\n }\r\n this.filteredCountries = filtered;\r\n console.log(this.filteredCountries);\r\n }\r\n}\r\nExploreComponent.ɵfac = function ExploreComponent_Factory(t) { return new (t || ExploreComponent)(i0.ɵɵdirectiveInject(i1.CityService)); };\r\nExploreComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ExploreComponent, selectors: [[\"app-explore\"]], decls: 19, vars: 5, consts: [[\"href\", \"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css\", \"rel\", \"stylesheet\", \"integrity\", \"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x\", \"crossorigin\", \"anonymous\"], [\"lang\", \"en\"], [\"charset\", \"utf-8\"], [1, \"navbar\", \"navbar-expand-sm\"], [1, \"navbar-brand\"], [1, \"navbar-nav\", \"ml-auto\"], [1, \"nav-item\"], [\"field\", \"name\", 3, \"ngModel\", \"suggestions\", \"minLength\", \"ngModelChange\", \"completeMethod\"], [\"role\", \"main\", 2, \"background-color\", \"#F9F2E8\"], [1, \"bg-dark\", \"text-center\", \"text-white\"]], template: function ExploreComponent_Template(rf, ctx) { if (rf & 1) {\r\n i0.ɵɵelement(0, \"link\", 0);\r\n i0.ɵɵelementStart(1, \"html\", 1);\r\n i0.ɵɵelementStart(2, \"head\");\r\n i0.ɵɵelement(3, \"meta\", 2);\r\n i0.ɵɵelement(4, \"title\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(5, \"body\");\r\n i0.ɵɵelementStart(6, \"header\");\r\n i0.ɵɵelementStart(7, \"nav\", 3);\r\n i0.ɵɵelementStart(8, \"strong\", 4);\r\n i0.ɵɵtext(9, \"Trivia Trip\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(10, \"ul\", 5);\r\n i0.ɵɵelementStart(11, \"li\", 6);\r\n i0.ɵɵelementStart(12, \"p-autoComplete\", 7);\r\n i0.ɵɵlistener(\"ngModelChange\", function ExploreComponent_Template_p_autoComplete_ngModelChange_12_listener($event) { return ctx.text = $event; })(\"completeMethod\", function ExploreComponent_Template_p_autoComplete_completeMethod_12_listener($event) { return ctx.search($event); });\r\n i0.ɵɵpipe(13, \"async\");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelement(14, \"li\", 6);\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementStart(15, \"main\", 8);\r\n i0.ɵɵtext(16, \" wfeefew \");\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelement(17, \"br\");\r\n i0.ɵɵelement(18, \"footer\", 9);\r\n i0.ɵɵelementEnd();\r\n i0.ɵɵelementEnd();\r\n } if (rf & 2) {\r\n i0.ɵɵadvance(12);\r\n i0.ɵɵproperty(\"ngModel\", ctx.text)(\"suggestions\", i0.ɵɵpipeBind1(13, 3, ctx.cities))(\"minLength\", 1);\r\n } }, directives: [i2.AutoComplete, i3.NgControlStatus, i3.NgModel], pipes: [i4.AsyncPipe], styles: [\"\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJleHBsb3JlLmNvbXBvbmVudC5jc3MifQ== */\"] });\r\n"]},"metadata":{},"sourceType":"module"} |
---|