I recently started exploring with yeoman to develop angular applications. I am facing an issue while trying to create routes using yo:angular route.
After running the command:
yo:angular route foo
yeoman generates the following files:
app/scripts/controllers/foo.js (controller)
app/views/foo.html (view)
app/test/spec/controllers/foo.js (testing the controller)
In app.js, it adds the following configuration:
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/foo', {
templateUrl: 'views/foo.html',
controller: 'FooCtrl'
})
.otherwise({
redirectTo: '/'
});
});
Everything seems correct yet the route doesn't work as expected - when I try to open
http://localhost:9000/foo
I encounter the following error:
Cannot GET /foo
The concept of routes in yeoman appears straightforward, and I am unable to pinpoint the source of this problem.