Angularjs directives and compatibility

Asked

Viewed 266 times

-1

I have the following doubts regarding AngularJS

The directives, I am obliged to create them if I want to use a certain plugin?

When it’s right to create them?

What about compatibility with other plugins, if you want certain effect or action using jQuery, as I have to do?

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

The AngularJs it always seemed good to me, but I was always in doubt, if I want to wear something outside of it, it is very laborious.

  • yes can yes look here at the beginning it says it works with bootstrap https://www.youtube.com/watch?v=EVAbVboRtGA&index=7&list=PLr6R3Zglau2nXmZHkcl-0pcU1XChEFzZM&spfreload=1

2 answers

1

inserir a descrição da imagem aqui

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

  • 2

    Whenever possible, make the answer available as text, this allows the answer to be searchable and serve for future queries through the search engine.

0

The directives, I am obliged to create them if I want to use a certain plugin?

No. Directives serve for you to create some element in your project, preferably that can be reused in another area without having to rely on other areas of your application. For example, a directive that converts the text to all lowercase and no accents. E.g.: Sao Paulo -> sao paulo;

When it’s right to create them?

Answered above.

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

Simple, include jQuery in the project and make it look like you’re only working with jQuery. BUT! A tip, NEVER mix Angularjs and jQuery. At first I also faced the same dilemma, but when I actually learned Angularjs, I realized that it supposes well to say all the use needs of jQuery. To this day, there has been no situation where jQuery is needed. Even for the fact that Angularjs itself has a mini library with functions migrated from jQuery. jqLite, read more here.

And about using other plugins, for example, Moment for dates, I should always create directives?

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

Angularjs always seemed good to me, but I’ve always been in doubt, if I want to use something outside of it, it’s a lot of work.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.