How to use anchor in AngularJS?

2

I'm starting to work with AngularJS and I have the following situation I have a href that redirects to a div within the page itself by the div id:

<a href="#teste"></a>
<div id="teste"></div> 

But AngularJS tries to read this test called by href as if it were a view, does anyone know how to circumvent it? Maybe something that makes the href identify that it is anchor and not a view, or else that you know is welcome too.

    
asked by anonymous 21.06.2018 / 22:20

1 answer

4

Probably this has nothing to do with Angular, only the # in href is missing.

See working:

html {
  scroll-behavior: smooth;
}

div {
  width: 90%;
  height: 120vh;
  background-color: red;
}

.blue {
  background-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><ahref="#teste">Ir para DIV</a>
<div></div>
<div id="teste" class="blue">
</div>
    
21.06.2018 / 22:38