creating ngdocs example with a custom directive

608 views Asked by At

Hello I'm trying to create a example for a directive with grunt-ngdocs: https://github.com/m7r/grunt-ngdocs

The documentation for the example tag is very poor so I could not create a working example not in ng-docs and also not in plnkr.

My example is looking like this:

 <example module="ex">

   <file name="controller.js">
   angular.module('ex', ['starter.directives']);
   function Ctrl($scope) {
        $scope.tasks = [{AuftragID: 1, Auftragsnummer: 111, Info: "Hallo", Result01: "Test"}];
    }
   </file>

   <file name="directive.js">
     angular.module('starter.directives', []);
     .directive('cgTaskCard',function() {
      return {
        restrict:'E',
        scope: {
          task: '=',
          mode: '='
        },
        templateUrl: 'cgTaskCard.html',
        link: function($scope, element, attrs){
        },
        controller: function($scope) {
        }
      };
    });
   </file>

   <file name="cgTaskCard.html">
     <div class="list card" ng-class="mode.nightMode">
       <div class="item item-divider text-small" ng-class="mode.nightModeContrast">
         <span>Auftragsnummer: {{task.Auftragsnummer}}</span>
       </div>
       <a ng-href="#/app/tasks/{{task.AuftragID}}" class="item item-text-wrap" ng-class="mode.nightMode">
         <div>
           <div ng-if="task.Info"><b>{{task.Info}}</b></div>
           <div ng-if="task.Result01">{{task.Result01}}</div>
         </div>
       </a>
     </div>
   </file>

   <file name="index.html">
     <ion-view ng-controller="Ctrl">
       <ion-content ng-class="mode.nightMode">

         <ion-refresher
         pulling-text="Aktualisieren..."
         on-refresh="">
         </ion-refresher>

         <cg-task-card
         ng-repeat="t in tasks"
         task="t"
         mode="mode">
         </cg-task-card>

       </ion-content>

     </ion-view>
   </file>

 </example>

The directive works great on run-time the problem is only to create a example for the documentation of the software I write.

The plnkr is here:

http://plnkr.co/edit/2ZnWoCAyRPfEzPJ07Qph?p=preview

0

There are 0 answers