javascript - AngularJS add Action to Controller -


i've been using other mvc frameworks i'm new angularjs , have ran issue. have controller called "projects" , route /projects want able /projects/java call new page template/view , display content.

how in angularjs? there way create actions projects or have else?

angular     .module('konradapp', [         '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('konradapp')     .controller('projectsctrl', function () {      }); 

what you're after way add nested views. refer ui-router docs on how that: https://github.com/angular-ui/ui-router/wiki/nested-states-%26-nested-views

the idea add nested ui-view in projects.html , add child route sub-view.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -