Hello, welcome to therichpost.com. In this post, I will tell you Angularjs1 Routing Script With Controller Names. Nowadays Angularjs is very popular and known as one page website. I am familiar with Angularjs1 very well but Angularjs2 is totally different with Angularjs1. Angular2 is totally command based.
We can do custom jquery code in angularjs but we should follow the angularjs standard.
Here is working code for Angularjs1 Routing Script With Controller Names and you need to add this script into your js file:
‘use strict’;
angular
.module(‘project’, [‘ngRoute’])
.config(function ($routeProvider) {
$routeProvider
.when(‘/cmap/:id?’, {
templateUrl : ‘views/cmap.html’,
controller : ‘CMapCtrl’,
controllerAs : ‘cmap’
})
.when(‘/importshare’, {
templateUrl : ‘views/import-share.html’,
controller : ‘ImportShareCtrl’,
controllerAs : ‘importshare’
})
.when(‘/settings’, {
templateUrl : ‘views/settings.html’,
controller : ‘SettingCtrl’,
controllerAs : ‘settings’
})
.when(‘/csheduler’, {
templateUrl : ‘views/csheduler.html’,
controller : ‘CSchedulerCtrl’,
controllerAs : ‘csheduler’
})
.otherwise({
redirectTo : ‘/cmap/’
});
});
There are many more in Angularjs and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com
Recent Comments