(function() {
function AppController($router) {
$router.config([
{path: '/courses',component: 'courses'},
{path: '/',component: 'welcome'}
]);
}
angular.module('MainApp', ['ngNewRouter'])
.controller('MainController', ['$router', 'CourseRepository', AppController, '$scope', function($scope) {
$scope.$on('clicked', function(e){
$scope.tgState = !$scope.tgState;
})
}]);
})();
I am trying to connect new angular route in one controller with some function I wrote. It works if I will do it in 2 separate controllers, but somehow it doesn't when I'm trying to connect it in one controller.