Menu icon Foundation
Foundation For Apps Open Panel On Partial Load

I'm display a collection of panels and one particular panel I want to open #custom-panel when the particular page is loaded.

I don't see a method to invoke this in the documents.

foundation for appspanels

I'm display a collection of panels and one particular panel I want to open #custom-panel when the particular page is loaded.

I don't see a method to invoke this in the documents.

Geoff Kimball almost 4 years ago

Foundation for Apps has a pub/sub system which can broadcast open/close events to components like Panel. You use the foundationApi service, which is in the foundation.core module. It's described in more detail here (scroll down until you get to the section on foundation.core.

The method you want is .publish().

FoundationApi.publish('id', 'action')

id is the ID of the panel in the HTML, and action is the event to broadcast. show will open the panel, and hide will hide it. This works for modals also.

Let me know if that works for your use case!

Preston almost 4 years ago

Still giving it a try. I actually modified what I'm trying to do a bit.

I'm adding a click event to a google map and then trying to show my custom panel. I'm getting FoundationApI not found.

Preston almost 4 years ago

That didn't seem to work.

It says foundationAPI not found.

Geoff Kimball almost 4 years ago

Hm, can you post that bit of code (maybe the module/service/etc. where you're injecting it), along with the full error/stack trace you get?