-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(documentation): Added the layers attribute documentation
- Loading branch information
1 parent
62a5e75
commit d26b01a
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'layers' Attribute Documentation | ||
================================== | ||
|
||
This sub-directive needs the **leaflet** main directive, so it is normaly used as an attribute of the *leaflet* tag, like this: | ||
|
||
``` | ||
<leaflet layers="layers"></leaflet> | ||
``` | ||
|
||
It will map an object _layers_ of our controller scope with the corresponding object on our directive isolated scope. It's not a bidirectional relationship, so only the changes made in this object on the controller scope will affect the map center position. Let's define the layers model with an example: | ||
|
||
``` | ||
$scope.layers = { | ||
layers: { | ||
baselayers: { | ||
osm: { | ||
name: 'OpenStreetMap', | ||
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
type: 'xyz' | ||
}, | ||
cloudmade: { | ||
name: 'Cloudmade Tourist', | ||
type: 'xyz', | ||
url: 'http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', | ||
layerParams: { | ||
key: '007b9471b4c74da4a6ec7ff43552b16f', | ||
styleId: 7 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
We can see that the _layers_ definition is conformed by lot attributes that we are going to describe belo. When we associate that object with our _leaflet-directive_ the unidirectional relation will start, and the first layer will be shown on the map and a new layer-switcher-control will appear on our map. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters