This component can be used to properly display nanorep articles (not only as plain HTML but with support of all features like automatic assets resizing, multipage answers, truncated mode, etc)
answer
- Object
of the article model (required)contentHeight
- number|string
to specify height of article element in collapsed mode (optional). In the case of number
- height will be in pixels. In case of string
- height will be as is1. Add script to your page:
<script src="https://<AccountName>.nanorep.co/web/include.js?sdk=quick-answer"></script>
2. Create <div>
:
<div id="example-container"></div>
3. Initialize QuickAnswer component:
// initialize SDK with common parameters nanorep.sdk.init({ host: '<AccountName>.nanorep.co', // 'vodafoneuk.nanorep.co' for example account: 'product_demo', kb: 'Docs' }); // initialize article component var article = new nanorep.sdk.QuickAnswer({ answer: {...}, contentHeight: 62 }, document.getElementById('example-container'));
toggle(state?: Boolean)
- toggle article view. click
- occurred when answer was clicked (exept click on feedback and truncation controls)expand
- occurred when answer expandedcollapse
- occurred when answer collapsedfeedback
- occurred when user send any feedback - positive or negative (Args: feedbackObject: Object
)Add i18n
library in include.js
script at the top of the page
Check how to use localisation here