Facu Ferrari
Facu Ferrari

Reputation: 143

Nested directive within ng-view doesn't work AngularJs

I developing a SPA using the native directive from angular ng-view to change views, the problem is that One of those views there is a custom directive I've wrote and when the route is loaded the directive doesnt work.

Here it is the config method of the App and the custom directive that doesn't fire up :S

climbingApp.config(
        function( $routeProvider ){
            $routeProvider.

            when('/', {
                controller: 'AppCtrl'
            }).

            when('/newSector', {
                template: '<formNewSector></formNewSector>',
                controller: 'addSector',
            }).

            otherwise({ redirectTo: '/'});
        }
    );


climbingApp.directives

        .directive(
            'formNewSector',
            function() {

                return {
                    restrict: 'E',
                    template: "<div>gato</div>",
                    replace: true,
                    link: function( scope, iElement, iAttrs ){

                    }
                }
    });

Upvotes: 1

Views: 936

Answers (1)

lort
lort

Reputation: 1457

You misspelled markup for directive in your template. For directive named formNewSector it should be <form-new-sector>, not <formNewSector>.

Upvotes: 3

Related Questions