Search code examples
angularjsangularjs-directiveangular-directive

angular directive does not render


I'm having problems with angular directives. I created a custom directive but it's not appearing and i don't know why. I can access the view specified in templateUrl with using localhost.

If somebody could help me that would just be great.

Thanks.

messageListDirective.js

angular.module('neat')
    .directive('message-list', function() {
        return {
            restrict: 'E',
            templateUrl: '/views/utils/messageList.html'
        }
    });

messageList.html

<h4>MESSAGE LIST</h4>

And the view where I'm using the directive:

messageBoard.html

<message-list></message-list>

Solution

  • change directive:

    .directive('message-list', function() { 
    

    to

    .directive('messageList', function() {      
    

    angular normalize element tags. Read this for more info