AngularJS directives and compatibility

-1

I have the following doubts regarding AngularJS

The policies, am I required to create them if I want to use a particular plugin?

When is it right to create them?

What about compatibility with other plugins, if I want a certain effect or action using jQuery , how do I do it?

What about using other plugins, for example, moment for dates, should I always create policies?

AngularJs has always seemed good to me, but I've always been in doubt, if I want to use something outside of it, it's very hard work.

    
asked by anonymous 11.03.2014 / 14:16

2 answers

1

You can usually use both, as in the example below:

    
11.03.2014 / 21:22
0
  

The policies, am I required to create them if I want to use a particular plugin?

No. Directives serve to you to create some element in your project, preferably that can be reused in another area without having dependence on other areas of your application. Example, a directive that converts text to all lowercase characters with no accents. Example: São Paulo - > Sao Paulo;

  

When is it right to create them?

Answered above.

  

And about compatibility with other plugins, if I want certain effect or action using jQuery, how do I do?

Simple, add jQuery to the project and do it as if you were only working with jQuery. BUT! One tip, NEVER mix AngularJs and jQuery. At first I also faced the same dilemma, but when I actually learned AngularJs, I realized that it fits well to tell all jQuery usage needs. To date, there has been no need to resort to jQuery. Even by the fact that AngularJs itself has a mini library with functions migrated from jQuery. jqLite, read more here .

  

What about using other plugins, for example, moment for dates, should I always create directives?

No. Normally when using an external plugin it already comes modularized so you should just use the attributes or call the functions, etc.

  

AngularJs always seemed good, but I was always in doubt, if I want to use something outside of it, it's very hard work.

Actually this is very simple and easier than it looks, you just get the hang of it and you will see that it is super quiet.

    
23.03.2016 / 18:07