How to make slideup / slidedown without a click event?

1

Hello, I'm starting at AngularJS and I have some doubts ... One of them is this.

I have the following code:

angular.module('ValueSelling.controllers', []).controller('startController', function($scope, $routeParams) {
    jQuery('body').removeClass("page--start page--filter page--favorites page--about page--search page--config page--help");
    jQuery('body').addClass("page--start");
    jQuery('.footer').slideUp();
}).controller('aboutController', function($rootScope, $location) {
    jQuery('body').removeClass("page--start page--filter page--favorites page--about page--search page--config page--help");
    jQuery('body').addClass("page--about");
    jQuery('.footer').slideDown();
    $rootScope.activetab = $location.path();
})

I would like to know how it would be possible to remove jQuery and switch to AngularJS. All the examples I see are through a click. In my case, it would be loading the controller.

    
asked by anonymous 29.07.2015 / 15:18

1 answer

-1

Maicon, the best way to do what you like is to use the famous AngularJS Directives . In them you manipulate the DOM as you see fit and it was designed just to manipulate DOM (insert html, change css and html structures).

angular.module('myDirectives', [])
.directive('myCustomer', function() {
  return {
    link: link(scope, element, attrs) {
      //Aqui dentro você possui acesso ao escopo da directive.
      //Element (html tag por exemplo)
      //Attributos que foram utilizados na sua directive.
    }
  };
});
    
29.07.2015 / 20:55