Adding ng-repeat throws an error: $ compile: ctreq
I have a custom directive that requires a leaf directive so that I can access the controller:
restrict: 'E',
require: '^leaflet',
scope: {
},
template: "",
link: function(scope, element, attrs, controller) {
}
When I use my custom directive in my app controller without implementation ng-repeat
, it works great. Like this:
HTML controller without ng-repeat
<leaflet defaults="defaults" center="center" markers="markers" layers="layers" paths="paths">
<ng-include src="/markers.html" />
<my-directive
waypoints="wps">
</my-directive>
</leaflet>
JS controller without ng-repeat
$scope.wps = [[32.745,-117.2776],[32.693,-117.3188]];
However, when I try to add ng-repeat
, I get the following error:
Error: [$compile:ctreq] http://errors.angularjs.org/1.3.12/$compile/ctreq?p0=leaflet&p1=myDirective
HTML controller with ng-repeat
<leaflet defaults="defaults" center="center" markers="markers" layers="layers" paths="paths">
<ng-include src="/markers.html" />
<my-directive
ng-repeat="(name, data) in routes"
name="{{ name }}"
waypoints="data.wps">
</my-directive>
</leaflet>
JS controller with ng-repeat
$scope.routes = {
r1: {
wps: [[32.745,-117.2776],[32.693,-117.3188]]
}
}
What have I messed up?
source to share
You have <ng-include src="/markers.html" />
before your directive. You need to explicitly close this tag. See this bug report .
source to share