Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Can the Drawer widget be used in a ngFor loop in Angular


I noticed in the documents that HTML components cannot be used directly in Angular, however, the drawer is displayed in the angular demo.

I've attemtped to use the drawer within a for loop (ngFor) and I'm unable to get it to function (i.e open the drawer).

I'm using a object's ID for the button ID :

<button id="{{listid}}_AddCard"
class="btn btn-outline btn-outline-dashed btn-outline-primary btn-active-light-primary btn-hover-rise me-5">
Add Card
</button>



and setting the data-kt-drawer-toggle using [attr.data-kt-drawer-toggle] :

<div id="kt_drawer_example_basic" class="bg-white" data-kt-drawer="true" data-kt-drawer-activate="true"
[attr.data-kt-drawer-toggle]="listid+"_AddCard""
data-kt-drawer-close="#board_view_settings_close"
data-kt-drawer-width="500px">


The ids and drawer-toggle attribute are being applied correctly, however, the drawer is not opening.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

In your code I don't see id attribute, it should be unique (and based on this id you have to rename 'close+toggle' attribute. Check the example from 'src/_metronic/partials/layout/activity-drawer/ActivityDrawer.tsx'.

Regards,
Keenthemes support


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(