-1

What should be the best practice using AngularJS with jQuery regular plugins. Like we want to open modal popup we use this code:

$("#MyModal").show("Show");

And What should we do working with AngularJS

Should we use it like same in jquery. Then what is point to use AngularJS?

danish farhaj
  • 1,316
  • 10
  • 20
  • **Best practice:** Use modals sparingly because they are interruptive. Their sudden appearance forces users to stop their current task and focus on the dialog content. Not every choice, setting, or detail warrants interruption. Alternatives to dialogs include menus or inline expansion, both of which maintain the current context. – georgeawg May 12 '17 at 17:57
  • 1
    See also [“Thinking in AngularJS” if I have a jQuery background?](http://stackoverflow.com/questions/14994391/thinking-in-angularjs-if-i-have-a-jquery-background) – georgeawg May 12 '17 at 18:00
  • that's what i was searching for. – danish farhaj May 15 '17 at 04:43

1 Answers1

1

We must use angular directive for this. There are quite a lot of angular directives available for bootstrap popup. We should never mix DOM manipulations inside angular controller. This way we cannot UNIT test and the whole purpose of Angular will be beaten. We should create Angular directives if we need to manipulate DOM.

Please use below one in your case

https://angular-ui.github.io/bootstrap/

Kiran B
  • 683
  • 10
  • 21
  • yes i know it. But is there a way to work without this? – danish farhaj May 12 '17 at 09:28
  • Yes definitely you can use the same old java-script. But its not the recommended way as we have to manipulate the DOM and we cannot unit test. The whole point of angular will be beaten if we use the DOM manipulations inside angular controllers. – Kiran B May 12 '17 at 09:32