mtchris
mtchris

Reputation: 79

This simple directive is not showing

I'm trying to learn Angular.

I have a plunker here: https://plnkr.co/edit/Qiu2SOjti2PVYhjRqO2O?p=preview

I'm trying to display a directive called 'simple' on the home page.

I'm not getting any console errors but the directive does not display.

(function(){
  angular.module('cxoJsApp').directive('simple', function(){
    return {
      restrict: 'E',
      controller: 'simpleController',
      controllerAs: 'simpleCtrl',
      scope: {},
      bindtoController: true,
      templateUrl: 'simpleDirective.html'
    };
  });
})();

Upvotes: 1

Views: 49

Answers (1)

GG.
GG.

Reputation: 21854

I fixed your plunker: https://plnkr.co/edit/loN714fULCcWrBhsN6C2?p=preview

You forgot to create the file homeController.js and to include all the files in your index.html:

<script src="app.js"></script>
<script src="simpleController.js"></script> 
<script src="simpleDirective.js"></script> 
<script src="homeController.js"></script>

Nothing wrong with your directive! :)

Upvotes: 2

Related Questions