Although I have experience with other MVC Frameworks, I am new to AngularJS and facing an issue. My controller is named "Projects" and the route is /projects. However, I want to be able to navigate to /projects/java where a new page template/view will be displayed.
I am uncertain how to achieve this in AngularJS. Is it possible to create actions for projects or should I explore alternative options?
angular
.module('uniqueApp', [
'ngRoute'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
title : 'Welcome',
templateUrl : 'views/main.html',
controller : 'MainCtrl',
controllerAs : 'main'
})
.when('/about', {
title : 'About',
templateUrl : 'views/about.html',
controller : 'AboutCtrl',
controllerAs : 'about'
})
.when('/projects', {
title : 'Projects',
templateUrl : 'views/projects.html',
controller : 'ProjectsCtrl',
controllerAs : 'projects'
})
.when('/contact', {
title : 'Contact',
templateUrl : 'views/contact.html',
controller : 'ContactCtrl',
controllerAs : 'contact'
})
.otherwise({
redirectTo : '/'
});
});
Controller:
angular.module('uniqueApp')
.controller('ProjectsCtrl', function () {
});