Angular 2 + Openlayers 没有 SourceVectorComponent 的提供者

Angular 2 + Openlayers No provider for SourceVectorComponent

我是 Angular 2 的新手,我正在使用 openstreet 地图构建仪表板应用程序,因此我使用这个 Angular2-openlayer.

当我尝试实现此代码时

    <aol-map [width]="'100%'">
        <aol-view [zoom]="4.98">
           <aol-coordinate [x]="118.015776" [y]="-2.600029" [srid]="'EPSG:4326'"></aol-coordinate>
        </aol-view>

        <aol-layer-tile>
            <aol-source-osm></aol-source-osm>
        </aol-layer-tile>

        <aol-feature>
        <aol-geometry-point>
            <aol-coordinate [x]="5" [y]="45" [srid]="'EPSG:4326'"></aol-coordinate>
        </aol-geometry-point>
        <aol-style>
            <aol-style-circle [radius]="10">
                <aol-style-stroke [color]="'black'" [width]="2"></aol-style-stroke>
                <aol-style-fill [color]="'green'"></aol-style-fill>
            </aol-style-circle>
        </aol-style>
    </aol-feature>

    </aol-map>

我遇到了这个错误

No provider for SourceVectorComponent!

你们能帮帮我吗?

此外,如果你们有更多使用此插件的示例,请给我一些链接,我将不胜感激。

谢谢

我不知道你是否还在寻找答案,但我遇到了同样的错误并解决了它。

您必须将您的 aol-feature 放在 2 个标签中(aol-layer-vector 和 aol-source-vector)。

<aol-layer-vector>
    <aol-source-vector>
         //your <aol-feature> here
    </aol-source-vector>
</aol-layer-vector>

我在ngx-openlayers的示例应用中找到了答案==> https://github.com/quentin-ol/ngx-openlayers/blob/master/example/src/app/app.component.html#L8

希望对您有所帮助!