Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(