Angular cursor directive and ngRepeat

I am trying to make a scheduling app using AngularJS. The main feature is to create a task. I want to put the source of the task into a directive:

<section id="runningTasks" ng-controller='RunningTaskCtrl as ctrl'>
    <task class="task" ng-repeat='task in ctrl.tasks'></task>


For each task, I add it to a div. Here is my directive definition:

.directive('task', function(){
    return {
        restrict: 'EA',
        templateUrl: '/Planificator/directives/task/task.html',
        link : function(scope, element, attrs){
            var date = $(element).find(".datepicker");
            date.datepicker("option", "dateFormat", "dd-mm-yy");


And the contents of task.html:

<div class="task" ng-click="task.editting = true" task>
    <h1>{{ task.title }}</h1>
        {{ task.comment }}
    <div class="edit-task" ng-show="task.editting">
        <form ng-submit="ctrl.propose(task)">
            ... form stuff ...


My problem is that when I run my page, I get the error:

Error: [$compile:multidir]$compile/multidir?p0=task&p1=task&p2=tem…3D%20true%22%20task%3D%22%22%20ng-repeat%3D%22task%20in%20ctrl.tasks%22%3E
    at Error (native)


(clean link: Angular error generator )

I already had this problem before and I just put the content of the template in ngRepeat and don't think anymore, but this time I would like to be fine.

Thanks for answers!


source to share

1 answer

Your problem:

<div class="task" ng-click="task.editting = true" task>


Since this is part of a template generated from a task directive, you try to add a task directive over and over.

Change to:

<div class="task" ng-click="task.editting = true">




All Articles