Binding ng-directives
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2017 10:44 PM
Hi All,
I am binding a number box to a html page and require the number box to use some ng-direvtives.
I am doing it as follows.
var bind = $sce.trustAsHtml("<input step=\"0.01\" ng-model=\"model\" ng-change=\"c.uiActionFunction('action')\" type=\"number\" "id=\"number\"/>")
<div ng-bind-html="bind"></div>
The number box works fine and I can retrieve the value however the ng directives don't work. After searching online its because you have to compile the variable to be able to use the directives but I don't see how this can be done in service now.
Does anyone have any suggestions on how to do this?
Thanks for any help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2017 04:27 PM
Hi lurii,
It will have to be a $compile use since there is never a preset amount of ng-directive's needed. I have been unable to get $compile working in service portal. Do you happen to have an example of this?
Thanks,
Roni Khalil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 03:10 PM
Hi Roni,
I have created a little example that demonstrates the concept. I added few comments there to help you understand the idea: https://codepen.io/anon/pen/qXarWN.
In an essence there is a directive called my-bind-html that binds and compiles custom HTML template to the scope.
Hope this helps.
Iurii