How to slideup/slidedown without a click event?

Asked

Viewed 74 times

1

Hello, I’m starting at Angularjs and I’m having 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 the case of mine, it would be when loading the controller.

1 answer

-1

Maicon, the best way to do what you have such features is to use the famous ones Directives of the Angularjs. In them you manipulate the DOM as you wish and it is designed precisely to manipulate DOM (insert html, modify 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.
    }
  };
});

Browser other questions tagged

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