How to use custom widget in Angular-app?

Good afternoon.

Has the user base of the widgets that are used on the website by other users and are loaded in the Ajax interface as needed. Widgets are pieces of HTML code with jQuery or pure javascript.
Can we make this functionality so that the rest of the site interface is written using Angular.

As I understand from what ponachitalis about Angular, this has to be wrapped in the Directive. But arbitrary custom widget will not wrap well.
September 19th 19 at 00:20
2 answers
September 19th 19 at 00:22
Solution
You are right, custom directives should be wrapped in the Directive of angular. If you change them will not work, you can offer to use the service $compile (https://docs.angularjs.org/api/ng/service/$compile) for the wrapper.
But if you assume that the model inside the widget will interact with the Angular-app, without editing the code will not work.
Thank you, doctor, prescribed what I needed!
Even found how to run arbitrary JS code received from the server lines. So you can even use jQuery in widgets. - christelle93 commented on September 19th 19 at 00:25
: you're welcome, just keep in mind that these techniques should be used very carefully:
1) It is unsafe.
2) heavy debit and catch errors.
3) You will use two rather big framework that will increase the time in support of this decision, and fixes bugs.

If Your final decision AngularJS, I recommend to rewrite your widgets in pure angular without using JQuery (or using a wrapper over plugins, thousands of them, and not only ngmodules.org). - oral_Lindgren64 commented on September 19th 19 at 00:28
I know that is unsafe. And debug problems. But after I started to do UI on the jQuery + Bootstrap Widgets, I realized that you need to look for another tool that will sew in the "noodles". Without going into details, the widgets in the General case can be written by users as extensions to the common interface, then rewrite them in Angular does not work, at least not yet invented as it to solve in an automatic or semi-automatic mode. Thanks for the link! - christelle93 commented on September 19th 19 at 00:31
September 19th 19 at 00:24
And in KnockoutJS this is very simple:
knockoutjs.com/documentation/custom-bindings.html
Thanks, but I have yet with angular.js to understand. We decided on it based on its popularity. Holivarnaya article Foo.Js VS Bar.Js unfortunately, do not give constructive when choosing the framework for those beginning to deal with this. - christelle93 commented on September 19th 19 at 00:27
The framework, though popular, but not very thoughtful. In large projects is not used. And I'm already developing version 2 in connection with the schools first. Google so all turned their attention to Polymer - oral_Lindgren64 commented on September 19th 19 at 00:30
As I understand the second major version of angular will not be soon, a year or so. About Polymer even heard of. Thanks for the tip, read. - christelle93 commented on September 19th 19 at 00:33

Find more questions by tags JavaScriptjQueryAngular