Skip to content

Custom directive example?  #2

Open
@reptillicus

Description

@reptillicus

I'm having trouble getting a custom directive going, does anyone have an exmaple that I can look at? Here's my simple test directive, basically should just dump an div that has the text "this is a chart" in it. How do I include this in directives.js? I'm getting an error like: "Error: Unknown provider: testProvider <- test <- testDirective"

I'm going for something like this plunker:

http://plnkr.co/edit/n7SZpyeQ9nbjVSYA7ibB?p=preview

define(['Console'], function (Console) {

  'use strict';

  var directive = ['test', function() {
    return {
      template: '<div></div>',  
      restrict: 'E',
      link: function postLink(scope, element, attrs) {
        element.text('this is a chart');
      }
    };
  }];
  return directive;

}); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions