Hello,

When working through the Custom directive section of my AngularJS book I am 
able to create a custom directive that hides the element it's attached to 
and only shows it briefly when changing routes. But I am only able to use 
it as a attribute (ng-bind="waiting") and not as an element(<waiting>).
This is the code:

var directives = angular.module("iShareApp.directives",[]);

directives.directive("waiting",["$rootScope",
    function($rootScope){
        return {
            restrict: "AE",
            link: function(scope,element,attrs){
                element.addClass("hide");
                $rootScope.$on("$routeChangeStart",function(){
                    element.removeClass("hide");
                });
                $rootScope.$on("$routeChangeSuccess",function(){
                    element.addClass("hide");
                });
            }
        };
    }
]);


<div ng-bind="waiting">Just a moment...</div>
is working: onLoad, the testnode is hidden, only during routechange the 
textnode is shown. But when I use the directive as an element the textnode 
is always visible:

<waiting>Just a moment...</waiting>
with restrict: "AE" or restrict: "E",

Is this a flaw in AngularJS v 1.2.6?

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to