codehero
codehero

Reputation: 509

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>

Upvotes: 1

Views: 979

Answers (2)

Afsar
Afsar

Reputation: 3124

change directive:

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

to

.directive('messageList', function() {      

angular normalize element tags. Read this for more info

Upvotes: 3

Nghi Nguyen
Nghi Nguyen

Reputation: 950

Did you import ng-controller="neat" in your messageBoard.html ?
If yes I think you should check the url to template.

Upvotes: 1

Related Questions