2017-04-11 83 views
0

我是Angular 2中的新成員,並且我正在用openstreet map構建儀表板應用程序,因此我使用這個Angular2-openlayerAngular 2 + Openlayers沒有SourceVectorComponent的提供商

當我嘗試實施這一代碼

<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> 

我有這個錯誤

無提供SourceVectorComponent!

你們能幫我解答嗎?

另外,如果你們有更多的例子使用這個插件,我真的很感激,如果你給我一些鏈接。

感謝

回答

1

我不知道,如果你還在尋找答案,但我碰到了同樣的錯誤,並解決它。

你必須將你的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

希望它可以幫助的示例應用程序!

+0

感謝您的回覆, btw我不再使用這個組件,我使用本地的開發者。 所以,我無法測試你的答案,但謝謝。 如果有人得到這個答案有幫助,不要忘記投票。 – bagas