Issue
Hi I've got follow tooltip
attribut with a value in one of my html tags (it's an attribut for a angurla-tooltip plugin):
<div tooltip="{ data: { onChange: ctrl.onChangeInTooltip }, template: '<wsc-number-input-helper-tooltip on-change="ctrl.data.onChange"></wsc-number-input-helper-tooltip>', class: 'cNumberInputHelperTooltip', pointerPosition: 'End'}"></div>
How can I make a string and assign it to a variable in my javascript from the attribut value within the tooltip
attribut? I've tried it like this:
let myAttributValue = "{ data: { onChange: ctrl.onChangeInTooltip }, template: '<wsc-number-input-helper-tooltip on-change="ctrl.data.onChange"></wsc-number-input-helper-tooltip>', class: 'cNumberInputHelperTooltip', pointerPosition: 'End'}";
let myAttributValue = "{ data: { onChange: ctrl.onChangeInTooltip }, template: "<wsc-number-input-helper-tooltip on-change="ctrl.data.onChange"></wsc-number-input-helper-tooltip>", class: "cNumberInputHelperTooltip", pointerPosition: "End"}";
Both don't work.
Any ideas?
EDIT (SOLUTION): How can I build a json string in javascript/jquery? - it works with JSON.stringify()
Thanks
Solution
Angular binding uses double-braces syntax, for instance:
<div tooltip="{{Thisisthetooltip}}" ... >
where in your JavaScript you would have:
$scope.Thisisthetooltip = "This is the actual tooltip text" ;
EDIT:
If the contents of the tooltip is within a JSON-like string, you can do:
var l_tempo = JSON.parse(<your string>) ;
$scope.Thisisthetooltip = l_tempo.<the path to the element within the JSON> ;
Answered By - FDavidov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.