quentinlampin / ngx-openlayers

Angular2+ components for Openlayers 4.x
Mozilla Public License 2.0
137 stars 98 forks source link

When bring the SRC code into a project, 404 errors occcur when running in chrome. #78

Closed mattnumbereight closed 7 years ago

mattnumbereight commented 7 years ago

Hi,

I am new to angular 2 so this is properly something I have done incorrectly.

I put the code in the SRC folders into the a new project, I installed OpenLayers 3 and I thought I had done all correctly, however when I run the code I get the following error.

zone.js:2019 GET http://localhost:1985/app/angular2-openlayers/components/layers.js 404 (Not Found)

(angular2-openlayers is the SRC version ).

Interesting the file indeed does not exist, there seems to be a problem with sub folders when reading from the index files (components/layers etc).

Any help would be appreciated. :)

M

quentin-ol commented 7 years ago

Hmm, this isn't the "angular" way of doing things. You could check angular-cli to help you get started: https://github.com/angular/angular-cli#usage

mattnumbereight commented 7 years ago

HI Thanks for your response.

I got the angular maps working, the issue was,

The following code made angular think that /formats was a component, when angular cannot find a component that doesn’t exist it looks for it in a url (hence 404)

import { FormatComponent } from '../formats;

I just modified instances like these to use the full paths.

import { FormatComponent } from '../formats/format.component';

Then the maps shows on the web-page - in fact the whole package works very well I am using this to display PVT maps using the SourceTileWMSComponent source - all good so far !:

Not familiar with angular-cli - will read up.

But thank you for sharing this code - I am using on a commercial international project.

M