Hello,

I'm working for the first time with angularjs and foundation 5.

Things were working good, but I stomp in a "simple" problem.

Where is the best place to put $(document).foundation(); to boot all the 
components?

My index is built with some custom directives and a ng-view (routing). 
Some foundation components, like dropdowns are located on the custom 
directives and others are locate inside the views that will be loaded on 
the ng-view.

If I use $timeout I can "fix" the problem...

For example, putting this function on my main model the problem disappears. 
But the delay added on $timeout could be not enough on slow internet 
connections.
 
app.run(function ($timeout)
    {
        $timeout(function () 
        { 
            $(document).foundation({ offcanvas: { open_method: 'move', 
close_on_click: false } });

            console.log("foundation init on $timeout"); 
        }, 500);
    });

 If I use something like:
  
app.run(function ($rootScope){
    $rootScope.$on('$routeChangeSuccess', function ()
    {
        $(document).foundation({ offcanvas: { open_method: 'move', 
close_on_click: false } });

        console.log("foundation init on $routeChangeSuccess");
    });});
            

         Components will work only after the view is loaded. If my custom 
directives load first than the content on ng-view, which is the case, the 
components inside the custom directives added directly on the index will 
not work.

I also found Angular Foundation 
http://pineconellc.github.io/angular-foundation/ but I´m afraid to rely on 
another "framework" that can be deprecated on future foundation or angular 
updates.

So... How can I integrate foundation with angularJS and cover all the 
situations?

thank you, for your time. 

-- 
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/d/optout.

Reply via email to