ng2-ui / auto-complete

Angular Auto Complete component and directive
https://ng2-ui.github.io/dist/#/auto-complete
MIT License
279 stars 122 forks source link

error update angular 7 solution #369

Open jorgeleal12 opened 5 years ago

jorgeleal12 commented 5 years ago

core.js:12584 ERROR Error: Http is required. at NguiAutoComplete.push../node_modules/@ngui/auto-complete/dist/auto-complete.js.NguiAutoComplete.getRemoteData (auto-complete.js:58) at NguiAutoCompleteComponent.push../node_modules/@ngui/auto-complete/dist/auto-complete.component.js.NguiAutoCompleteComponent.reloadList (auto-complete.component.js:169) at auto-complete.component.js:56 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:14134) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:496) at ZoneTask.invoke (zone.js:485) at timer (zone.js:2054)

jorgeleal12 commented 5 years ago

It works with Observable but with the route googleGeoCode: string = "https://maps.googleapis.com/maps/api/geocode/json?address=:keyword"; using it so it does not work out the error

jorgeleal12 commented 5 years ago

I found the solution to change the lines and put these functions very well I have solved it with the few knowledge that I have

auto-complete.js

var http_1 = require ("@ angular / http");

    return this.http.get (url) .pipe (        operators_1.map (list => {          if (_this.pathToData) {            var paths = _this.pathToData.split (".");            var paths_1 = paths [0];            let json = list.json ();            console.log (json [paths_1]);            return json [paths_1];          }        })      );

  return [{type: http_1.Http, decorators: [{type: core_1.Optional}]}];