app.config(function($routeProvider) {
$routeProvider
.when('/skills', {
templateUrl: 'skill.html',
controller: 'SkillThemeCtrl'
})
.when('/exp', {
templateUrl: 'exp.html',
controller: 'ExpThemeCtrl'
})
.when('/', {
redirectTo: '/skills'
})
.otherwise({
template: '<h1>404</h1>' //or templateUrl: '<h1>404</h1>'
});
});
app.controller('ThemeCtrl', ['$http',
function($http) {
var ctrl = this;
ctrl.updateTheme = function(getTab) {
}
}
]);
app.controller('SkillThemeCtrl', function() {
updateTheme(1); //This is not working. This function is in ThemeCtrl
});
app.controller('ExpThemeCtrl', function() {
updateTheme(2); //This is not working. This function is in ThemeCtrl
});
I want to access a Function which is defined inside a Controller from another Controller. I am just learning Angular so please make it simple. I tried different approaches which i was practising in other languages but no chance at all. Thanks alot