Ng2 Expansion Panels
This is a component for Angular 2. Design is inspired by Material Design's component Expansion Panels.
Development is in very early stage
Demo
Check out the live demo (with source code) here http://www.webpackbin.com/EJOlX3j6Z.
Installing
npm install ng2-expansion-panels --save
Configuration
Ensure you import the module:
; // please notice this is the new way of telling a Component// to import another component...no more directives[]@ {}
API
onOpen
- [?onOpen(panel: ExpansionPanelComponent)
] - event fired when a panel is openedonClose
- [?onClose(panel: ExpansionPanelComponent)
] - event fired when a panel is closedonSubmit
- [?onSubmit()
] - event fired whensubmit
is calledonCancel
- [?onCancel()
] - event fired whencancel
is called
Examples
Basic Example
Title Description when hidden Description when toggled Content ... ... ...
Add Buttons to a panel
Every panel has already defined two methods, cancel
and submit
. In order to bind those
to the buttons we define, we need to create a reference to the panel. In this example, I called it #panel
and them I'm calling panel.cancel() and panel.submit().
It is possible to listen to these events with the outputs onCancel
and onSubmit
.
Title Description when hidden Description when toggled Content Cancel Submit