Hi All ,
Is Handler the only option to call a servoy method from html ? . I am doing so but with no success .
var parent_template = '<div class="file-header"><a href="#"><i class="add-plus-icon" onclick=$scope.handlers.onMenuItemClicked("header" , "attachment");></i></a><span class="text">Document</span></div>';
This is not working . Why ? . Is there any other option to just call a servoy method .
Please provide suggestions.
Is that in a web component HTML file?
No that is not in the webcomponent html file . We are giving that html as the template to the webcomponent .
But basically that the HTML the webcomponent will use.
Try this:
var onClickMethod="handlers.onMenuItemClicked('header' , 'attachment');";
var parent_template = '<div class="file-header"><a href="#"><i class="add-plus-icon" ng-click="'+onClickMethod+'"></i></a><span class="text">Document</span></div>';
Thanks Juan for your support . But this is not working . Please help me.
Hi,
your approach won’t easily work. You are trying to use ng method within an HTML area.
You have some complexity which won’t easily allow you to achieve what you are looking for. Angular methods are bound to a specific scope, each component directive has his own scope, therefore in the case of the HTML area you are bound within the scope of the HTML component itself. And the HTML area doesn’t have an handler onMenuItemClicked(“header” , “attachment”), therefore your code as is simply won’t work.
What exactly are you trying to achieve exactly, what are you rendering in the HTML area what is your end goal ?
Regards,
Paolo
Hi ,
Thanks . Let me describe the entire stuff .
1.I am developing webcomponent using devexpress . This is context menu component where menu items are listed .
2.We are having a header menu item and child menu items.
3.We provide html template from servoy side to the component . So accordingly the context menu will be rendered . There is an itemTemplate event in which it is handled
4.There is an itemClick event in which we can call servoy handler method . We can pass the text of the menu item.
5.Our requirement is , we are having a small icon in the header . only on that click we have to show a servoy dialog . How to achieve this ? .
Please provide suggestion.
Sorry . I has an easy solution . I could able to do it by passing the classname of the icon .
Thanks