Abijeet Patro Abijeet Patro - 22 days ago 8
Javascript Question

Angular 1.5.x - Directive not firing

I'm practicing working with directives, and have been banging my head on this for a while now.

The code -

Module



angular.module('wbHeader', []);


Controller



angular.module('wbHeader').controller('wbHeaderController', ['$scope', function() {

}]);


Directive



angular.module('wbHeader').directive('wbHeader', function() {
return {
transclude: true,
restrict: 'AEC',
scope: {

},
controller: 'wbHeaderController',
templateUrl: '/modules/wb-header/header.html'
};
});


Plunker -



https://plnkr.co/edit/OUrCm1mGb5K0wN8u2Ke9?p=preview

I feel like I'm overlooking something simply, but not sure!

Answer

Yes simple,In your code ng-app should be renamed as

Change

From

<html ng-app="wbApp">

To

<html ng-app="wbHeader">

DEMO

Comments