Having trouble creating a Directive that includes another directive from the AngularJS UI.
Check out my html:
<div class="col-md-12" ng-show="continent == '2'">
<my-rating></my-rating>
</div>
Here is the directive code:
.directive('myRating', function() {
return{
restrict: 'E',
template: '<div class="row question">{{questions.3A.name}}</div> \
<div class="row rating" ng-controller="RatingDemoCtrl"> \
<rating value="rate" max="max" readonly="isReadonly" state-on="\'glyphicon-star rated\'" state-off="\'glyphicon-star\'"></rating> \
<div class="col-md-12"> \
<button class="btn btn-sm btn-danger form-control" ng-click="rate = 0" ng-disabled="isReadonly">Clear</button> \
</div> \
</div>',
replace: true,
scope: {
text: '@'
}
};
})
I've tried adapting this directive from a working one, but as soon as I include additional code beyond the div class="col-md-12", it causes Angular to crash.
What could be causing this issue?
UPDATE: I've created a Plunker example. The problematic directive can be found in line 34-42 in script.js), everything else seems to be functioning correctly.
UPDATE 2: Here's the console Error message:
Error: [$compile:tplrt] http://errors.angularjs.org/1.2.13/$compile/tplrt?p0=myRating&p1=
at Error (native)
at file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:6:450
at Wa (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:51:416)
at L (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:43:62)
at L (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:43:184)
at L (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:43:184)
at L (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:43:184)
at L (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:43:184)
at Y (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:41:360)
at Wa (file:///C:/Users/Zuh/Desktop/ANGULARJS/js/lib/angular.min.js:51:164) angular.min.js:85