Skip to content

Commit

Permalink
feat(documentation): Added the layers attribute documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tombatossals committed Dec 28, 2013
1 parent 62a5e75 commit d26b01a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
35 changes: 35 additions & 0 deletions doc/layers-attribute.md
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.
2 changes: 2 additions & 0 deletions doc/leaflet-directive.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ We have much more possibilities than showing a simple map, but this will need th
* [_center_ attribute](https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/center-attribute.md)
* [_bounds_ attribute](https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/bounds-attribute.md)
* [_maxbounds_ attribute](https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/maxbounds-attribute.md)
* [_tiles_ attribute](https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/tiles-attribute.md)
* [_layers_ attribute](https://github.com/tombatossals/angular-leaflet-directive/blob/master/doc/layers-attribute.md)

0 comments on commit d26b01a

Please sign in to comment.