M
M
maximw2015-03-02 10:51:23
JavaScript
maximw, 2015-03-02 10:51:23

How to use custom widget in Angular app?

Good afternoon.

There is a user base of widgets that are used on the site by other users and loaded into the interface by Ajax as needed. Widgets are pieces of HTML code with jQuery or pure javascript.
You can somehow make friends with such functionality with the fact that the rest of the site interface will be written using Angular.

As I understand from what I read about Angular, such things should be wrapped in directives. But you can't wrap an arbitrary custom widget.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DigitalSmile, 2015-03-02
@maximw

You are right, custom directives should be wrapped in angular directives. If you can't change them, I can suggest using the $compile service ( https://docs.angularjs.org/api/ng/service/$compile ) for the wrapper.
But if it is assumed that the models inside the widget will interact with the Angular application, then without editing the code it will not work.

K
Kir ---, 2015-03-02
@SowingSadness

And in KnockoutJS this is very easy:
knockoutjs.com/documentation/custom-bindings.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question