Make anchor in AngularJS

1
Hello, I need to create an anchor in which when I click on a link it display block arrow in a hidden div and scroll down the page up to that div. The part of giving block display I've done, what I need is the part where I click the link and the page comes down. I'm using Angular, so I can not use #id_div for this. Anyone have any ideas?

    
asked by anonymous 09.03.2016 / 19:14

1 answer

1

Hello, I was able to solve this problem in the following way: in the link, I put a scrollTo with the id of the div that it should go:

<a href="" ng-click="vm.scrollTo('box')">

In the div I put the id of it normal né:

<div id="box" class="col-md-12">

In the controller of my page, it is necessary to put a function to scroll down, which in my case was:

vm.scrollTo = function (id) {
        setTimeout(function() {
            $location.hash(id);
            $anchorScroll();
        }, 100);
    };

I put the set timeout because it happened that I had to click 2 or 3 times on the link so he could get down the page, so the bug is solved

    
11.03.2016 / 11:48