yeoman / generator-angular

Yeoman generator for AngularJS
http://yeoman.io
5.74k stars 1.45k forks source link

route does not work #1393

Closed AkbarAlam closed 7 years ago

AkbarAlam commented 7 years ago

I am having an issue with yo angular. It's generating the app, grunt serve is running locally. But when i click the about button it does not go to about page

Here is some code (these are generated by angular generator).

`div class="collapse navbar-collapse" id="js-navbar-collapse">

    <ul class="nav navbar-nav">
      <li class="active"><a href="#/">Home</a></li>
      <li><a ng-href="#/about">About</a></li>
      <li><a ng-href="#/">Contact</a></li>
    </ul>
  </div>
</div>

`

app.js file

` 'use strict';

angular .module('coolAppApp', [ 'ngAnimate', 'ngCookies', 'ngResource', 'ngRoute', 'ngSanitize', 'ngTouch' ]) .config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl', controllerAs: 'main' }) .when('/about', { templateUrl: 'views/about.html', controller: 'AboutCtrl', controllerAs: 'about' }) .otherwise({ redirectTo: '/' }); }); `

AkbarAlam commented 7 years ago

it works with putting ! before /

which means <li><a ng-href="#!/about">About</a></li>

amitntrivedi commented 7 years ago

Yes This works for me as well.

flamingunicorn commented 7 years ago

thank you

xtremebiker commented 6 years ago

Same for me. Solved with your workaround, but why did you close it? Shouldn't it get fixed, better?