Why is jQuery in the Angular controller bad?

People seem to be against using jQuery from an Angular controller. Why??

Suppose you have:

<div id="test">{{test}}</div>
<button class="btn" ng-click="foo()">test</button>

and

.controller('testCtrl', function($scope, $http, $state){

    $scope.test = 'this is the test scope';

    $scope.foo = function(){

        angular.element("#test1").toggle(300);      
    }

}) 

It..

  • simply
  • native
  • quickly
  • clean
  • readable
  • logical sound

.. a way to manipulate the DOM.

In addition, you adopt the powerful Angular framework and incorporate tried and tested technologies, and we all know and love. (at least me)

, DOM, . , , , DOM - ? ! , , DOM-. , , , , jQuery .

, . - , jQuery ?

+4

Source: https://habr.com/ru/post/1664066/


All Articles