javascript - Yeoman and angular - routing doesn't work -


i'm trying start developing angular apps yeoman. may sounds stupid, have problem creating routes using yo:angular route.

when create new route using:

yo:angular route foo 

yeoman creates:

app/scripts/controllers/foo.js              (controller) app/views/foo.html                          (view) app/test/spec/controllers/foo.js            (testing controller) 

in app.js creates:

  .config(function ($routeprovider) {    $routeprovider   .when('/', {     templateurl: 'views/main.html',     controller: 'mainctrl'   })   .when('/foo', {     templateurl: 'views/foo.html',     controller: 'fooctrl'   })   .otherwise({     redirectto: '/'   }); }); 

so should work fine. unfortunately route doesn't work - when try open

http://localhost:9000/foo 

i following error:

cannot /foo 

the idea of routes in yeoman looks pretty easy , i'm not sure problem is.

did enable html5 mode in angular application? if not, url be:

http://localhost:9000/#/foo 

and if have enabled html5 mode in angular application, have make sure whatever server you're using has been configured handle routes root of application.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -