http://tombatossals.github.io/angular-leaflet-directive/examples/simple-example.html
Неre就是我需要的例子。
http://tomaszdziurko.pl/wp-content/uploads/2013/02/navbar_angularjs1.png
但我需要第三页的这张地图。
我应该把什么放在控制器上?
var App = angular.module('App', []);
App.config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
// route for the about page
.when('/third', {
templateUrl: 'pages/third.html',
controller: 'thirdController'
});
App.controller('thirdController', function ($scope) {
angular.extend($scope, {
defaults: {
scrollWheelZoom: false
}
});
});在html上,我刚刚设置了<leafset></leafset>
但这是错的。
谢谢。
发布于 2014-01-02 05:21:04
确保您正确地包含了该指令。
首先:
以正确的顺序包含所有必需的脚本:
<script src="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="/js/angular-leaflet-directive.min.js"></script>第二:
还包括CSS:
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.css">第三:
将该指令包含在应用程序依赖项中:
var app = angular.module("demoapp", ['leaflet-directive']);第三部分可能是您缺少的部分,因为在他们的网站上没有具体的文档记录。请参考代码中的简单示例:
https://stackoverflow.com/questions/20873166
复制相似问题