AngularjsAngularjs1

Angularjs1 Routing Script With Controller Names

Angularjs1 Routing Script With Controller Names

Views

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

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Positive SSL