Bug in _StickyComponents.ts

There's a bug in angular version within _StickyComponents.ts (src/app/_metronic/kt/components/_StickyComponents.ts)

In the following set of code :

private getOption = (name: string) => {
const dataStickyAttr = 'data-kt-sticky-' + name
if (this.element.hasAttribute(dataStickyAttr) === true) {
const attrValueInStr = this.element.getAttribute(dataStickyAttr)
const attrValue = getAttributeValueByBreakpoint(attrValueInStr || '')
if (attrValue !== null && String(attrValue) === 'true') {
return true
} else if (attrValue !== null && String(attrValue) === 'false') {
return false
}

return attrValue
} else {
const optionName = stringSnakeToCamel(name)
const option = getObjectPropertyValueByKey(this.options, optionName)
if (option) {
return getAttributeValueByBreakpoint(option)
}
}
}

A return doesn't exist if option is not available.

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 Prad,

If the option does not exist, it should return undefined. You can use this code to check the value.

if (typeof value !== 'undefined')

Thanks

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  :(