Modal W3.CSS conflicts with Angularjs

Asked

Viewed 198 times

1

I’m experiencing the W3.CSS in an application Angularjs which until then used Bootstrap CSS.

But the modal of W3.CSS uses anchor to open, already the Angularjs interprets the anchors as routes and redirects to the route.

How do I have a otherwise, it redirects to the / and does not open the modal. If I register a route to the modal, the Angularjs opens as a page and not as a modal.

I would like guidance on how to proceed in this case.

  • Just one thing I didn’t understand, I thought W3.css was just pure CSS, the links that define is you aren’t? Puts an example of this Modal.

1 answer

0

Use the service $AnchorScroll. Example of implementation:

app.run(function($rootScope, $location, $anchorScroll) {
  $rootScope.$on('$routeChangeSuccess', function(newRoute, oldRoute) {
    if($location.hash()) $anchorScroll();  
  });
});

You can then create links containing the route and the desired anchor as well:

<a href="#/rota#ancora">Rota/Âncora</a>

Source.

  • I’ll test when I get home or if I find myself here, where should I put it? It can be below the app.config(); ?

  • I was able to test here quickly, but it still didn’t work...

Browser other questions tagged

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