Menu icon Foundation
Foundation Sticky element in Angular2

I'm trying to make Foundations Sticky work in my Angular2 application. Apart of the issue that I can't destroy the Foundation element, using ngOnDestroy(), I struggle with the Sticky element in general. What I have is this:

Component Template

<div id="wrapperDiv">
        <div class="columns medium-2 no-pad-left" data-sticky-container>
          <div id="myStickyElement" class="sticky" data-sticky data-top-anchor="wrapperDiv">
            <aside>
              <ul class="menu vertical">
                <li><a href="#elm1">Elm1</a></li>
                <li><a href="#eml2">Eml2</a></li>
                <li><a href="#eml3">Eml3</a></li>
                <li><a href="#eml4">Eml4</a></li>
              </ul>
            </aside>
          </div>
        </div>
</div>

It might be important to say that wrapperDiv is loaded directly and has no ngIf condition in it's parents. 

 

In my component I use this in my ngAfterViewInit:

Component 

 ngAfterViewInit(): void {
    $('#myStickyElement').foundation();
 }

When I do a full page reload on this specific view, everything is super and works! If I navigate to this view, it it doesn't work. Seems to be related with the full page reload.

 

On some point I was creating the Sticky element like this:

let myStickyElement = new Foundation.Sticky($('#myStickyElement'));

 

Which did not have any impact on the behaviour, but I could print out the object myStickyElement.

On full page reload the object looks like this:

 enter image description here

 

And here if I navigate to the page:

enter image description here

As you can see, the object of myStickyElement looks way different. Something is missing. Has anyone come across this problem before? Why is the full page reload so much different?

 

angular2sticky. foundationangular

I'm trying to make Foundations Sticky work in my Angular2 application. Apart of the issue that I can't destroy the Foundation element, using ngOnDestroy(), I struggle with the Sticky element in general. What I have is this:

Component Template

<div id="wrapperDiv">
        <div class="columns medium-2 no-pad-left" data-sticky-container>
          <div id="myStickyElement" class="sticky" data-sticky data-top-anchor="wrapperDiv">
            <aside>
              <ul class="menu vertical">
                <li><a href="#elm1">Elm1</a></li>
                <li><a href="#eml2">Eml2</a></li>
                <li><a href="#eml3">Eml3</a></li>
                <li><a href="#eml4">Eml4</a></li>
              </ul>
            </aside>
          </div>
        </div>
</div>

It might be important to say that wrapperDiv is loaded directly and has no ngIf condition in it's parents. 

 

In my component I use this in my ngAfterViewInit:

Component 

 ngAfterViewInit(): void {
    $('#myStickyElement').foundation();
 }

When I do a full page reload on this specific view, everything is super and works! If I navigate to this view, it it doesn't work. Seems to be related with the full page reload.

 

On some point I was creating the Sticky element like this:

let myStickyElement = new Foundation.Sticky($('#myStickyElement'));

 

Which did not have any impact on the behaviour, but I could print out the object myStickyElement.

On full page reload the object looks like this:

 enter image description here

 

And here if I navigate to the page:

enter image description here

As you can see, the object of myStickyElement looks way different. Something is missing. Has anyone come across this problem before? Why is the full page reload so much different?

 

DaraCodes over 1 year ago

Hi Koch,

 

I am facing the same issue with foundation6 with angular2 for reveal modals. On full refresh it works fine but after navigation it did not work. At one place my grid dont show without refresh and at another place my radio buttons does not work properly.

Brian Weiss over 1 year ago

Are you destroying your elements properly in the ngOnDestroy method when the Angular2 destroys the Component?

renuka singh over 1 year ago

 The idea is to focus on facts and try and define a baseline problem to share.
Best Engineering college in Chandigarh
Fashion Technology College in Punjab

Maximilian Koch over 1 year ago

I could solve my problem with this: http://stackoverflow.com/questions/43098821/foundation-6-sticky-element-in-angular2

Mkt Bhavish over 1 year ago

The Fairdeal Group of Companies is a fast-growing group with the ambition of helping people across Kenya build their dream homes and offices.
Furniture in Kenya
Dealers in Affordable Office Chairs
Dealers in metal beds kenya
Visitors Chair dealers in Kenya
Dealers in wooden dining tables

Mkt Bhavish over 1 year ago

Moonlight Films and Theatre Studio operates under the Moonlight Films and Theatre Society , a non-profit association whose goals are to spread knowledge of and interest in theatrical and media arts through education.
Acting institute in Delhi
Diploma in filmmaking in Delhi
Acting school in Delhi

Mkt Bhavish over 1 year ago

VIGYAN DHARA is the first Indian IIT-JEE/ NEET/AIIMS coaching Institute which is purely based on Historical Indian Education System that is the Gurukul Tradition of Education where students leave their homes during their studies.
IIT coaching institute in hisar
IIT Coaching center in hisar

jiya joseph about 1 year ago

I didn’t understand the meaning of foundation sticky element. What is this all about? You have provided a code on this site. For what purpose should we use it? It will be good if you explain this in simple words. http://snoring-aid.com/

sheeraz about 1 year ago

Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post. Hero Instinct

sheeraz about 1 year ago

Thank you so much for ding the impressive job here, everyone will surely like your post. Health Benefits of Coffee

Nickwick 8 months ago

Thank you for sharing your post with us.I really liked it.Please check out my website and like comment and share what you feel    How to setup Netgear EX2700 wifi Extender , mywifiext ,Netgear Extender contact number , 123.hp.com printer setup

 

 

aolmail 6 months ago

We are back Aolmail Sign up with a new article on American Online Mail Login, shortly, AOL Mail Login. In this article, we are going to tell you about the history of the company, how it got shaped up over the years since its inception and its products under its niche.  AOLmail.com  or American Online is a Telecom biggie company which is now part of another telecom giant Verizon, but this was not the situation a few years back

Jigar Jaan 6 months ago

foundation 6 is also very problematic. 

Tummy Control Shapewear

ridhi sinha 4 months ago

I was looking for this. thank you for sharing.

rrb group d result

www.mywifiext.net 3 months ago

Thanks for sharing this information. I like your blog post very much.

always so interesting to visit your site.What a great info, You have shared an informative  thanks

www.mywifiext.net

new extender setup                                                

mywifiext setup

192.168.1.250

mywifiext

mywifiext.local

unable to connect mywifiext.net 

mywifiext.net not working 

netgear support

Elisa X 2 months ago

Thank you for sharing your post with us.I really liked it.Please check out my website and like comment and share what you feel www.canon.com ijsetup

adok kakal about 2 months ago

hey, I was looking for this. thank you for sharing. to watch movies online check GoMovies - The Alternative 123Movies Site

Brianna Garcia about 1 month ago

HI, Thank you! Your blog is very helpful and knowledgeable?. Thank you again.

www.123.hp.com setup

james bond 29 days ago

I take a full visit to your site and I found the great elements here. I grateful thanks to you to give me the chance to visit. I suggest you also to visit here Cyberlink Coupons you definitely find always new and interesting here. 

Hilda 16 days ago

I was also lost on this code too but I got some fast essay help on it and got back to my feet