Reputation: 143
I'm trying to use openlayers-directive inside a directive:
var app = angular.module("demoapp", ["openlayers-directive"]);
app.directive('myDir', function () {
return {
restrict: "E",
replace: true,
template: "<openlayers ol-center='center' height='480px' width='640px'></openlayers>"
}
})
In html:
<my-dir></my-dir>
But when I'm doing this, I have a multi-dir error
VM2731 angular.js:12221 Error: [$compile:multidir] Multiple directives [myDir, openlayers] asking for template on: <openlayers ol-center="center" height="480px" width="640px">
Any explanation will be usefull
Thanks!
Here is the fiddle
Upvotes: 0
Views: 59
Reputation: 1891
Your directive's template should have its own root <div>
, inside it will be placed the open-layers
directive. This way you're defining a separate template in which the nested directive can be compiled.
template: "<div><openlayers ol-center='center' height='480px' width='640px'></openlayers></div>"
Upvotes: 1