Conflict with ngRoute and JQuery

0

Colleagues, I have the following scenario, I am building a website of type SPA ( Single Page Application ), so I need to work with $routeProvider to link the routes to each view. So far so good, dynamic routes work well for me; the problem appears that despite doing what I need, the Chrome console detects an error of type

  

Uncaught Error: Syntax error, unrecognized expression: # / home.

Researching tried different ways to avoid this ( removing the slash, remove the hashtag, etc ) without any result. This error also affects me in that I am initially loading a slider with owl-carousel , but when I change the page and return to the initial slider, it does not show me the images = /

I'm attaching the HTML code

<nav id="nav-menu-container">
   <ul class="nav-menu">
      <li class="menu-active"><a href="#/home">Home</a></li>
      <li><a href="#/places">About Us</a></li>
   </ul>
</nav>

and the JS

app.config(['$routeProvider', '$locationProvider', 
  function ($routeProvider, $locationProvider) {
    //$locationProvider.html5Mode(true);
    $locationProvider.hashPrefix('');

    $routeProvider
      .when('/', { templateUrl: 'Pages/paraphrasing.html', controller: 'indexController' })
      .when('/home', { templateUrl: 'Pages/paraphrasing.html', controller: 'indexController' })
      .when('/places', { templateUrl: 'Pages/Norte/iregion.html', controller: 'northZoneController' })
}]);

Any suggestions you can give me to correct this? It would be appreciated

    
asked by Paulo Urbano Rivera 22.05.2018 в 22:28
source

1 answer

0

Try changing the links to use ui-sref= Something like this:

<nav id="nav-menu-container">
   <ul class="nav-menu">
      <li class="menu-active"><a href="#" ui-sref="home">Home</a></li>
      <li><a href="#" ui-sref="places">About Us</a></li>
   </ul>
</nav>
    
answered by 22.05.2018 / 22:48
source