$http.get を使用して、コントローラーで json ファイルを取得する必要があります。
module.controller 'SampleMapController', ($http, $scope) ->
$http.get('../../highcharts/mapdata/world.geo.json').
success (data) ->
$scope.mapData = data # works and logs out correctly
そして、それをディレクティブに渡します。ディレクティブは、マッピングの目的でその json を使用します。
module.directive 'MapDirective', () ->
require: '?SampleMapController'
templateUrl: '../template.html'
link: ($scope) ->
console.log $scope.mapData # undefined
$scope.$watch 'an.object.that.contains.more.data',
(newValue) ->
chart = new Highcharts.Chart({
chart: {
renderTo: 'container div'
}
# ... use $scope.mapData somewhere in here to render the global map
})
true
しかし、私はその $scope にアクセスする運がなく、$rootScope に配置する必要があるのか 、それともイベントがコントローラーを必要とするのかわかりません。
の内部で高チャート マップを生成しています。link:
私が探しているものの詳細な説明は、抽象化されたJSBinにあります。