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
Post a Comment