victor sosa
victor sosa

Reputation: 899

New Custom Angular Directive not working

I am trying to create a new directive to be use as a component in multiple projects. But the basic template is not even printing anything. You can check the plunker code sample and check that 'Hola' is not been printed. And there is not error in the console too.

angular.module('peoplewareDo.ng-Form-builder', []).directive('formBuilder', function () {
  return {
    //require: ['ngModel'],
        restrict: 'E',
    replace: true,
    templateUrl: 'Hola',//'ng-form-builder.html',
        scope: {
            form:'='
        }
    };
});

Here is my Plunker http://plnkr.co/edit/UEWTgDoVlFAUychrEC9D?p=preview

Also you can check the complete project under: https://github.com/peoplewareDo/ng-form-builder

Upvotes: 0

Views: 89

Answers (1)

DerekMT12
DerekMT12

Reputation: 1349

One problem is that 'peoplewareDo.ng-Form-builder' should have a lowercase F.

Another problem is that you're trying to inject $scope into a directive. You should use scope inside of the link function or inject $scope into the directive's controller.

Upvotes: 1

Related Questions