I'm using angular-ui router and I have a very simple todo app I'm making to learn more about angular 1.4. If I have my <ui-view></ui-view>
tags for my home controller, what is the best way to have a click in the header (to add a task effect my home view + controller?)
(My header HTML just has some anchor buttons, like add task, refresh list)
Header controller :
angular.controller('headerController', ['$scope', function($scope) {
$scope.addTask = function(){
//add a task or show toggle task form or call to something below in home controller
}
}]);
My home controller:
angular.controller('homeController', ['$scope', 'getTasks', function($scope, getTasks) {
$scope.todos = getTasks.load;
}]);
Should a service be made for something so simple? Or is this a job for rootscope, I know that rootscope should be avoided though as it pollutes global namespace. Thank you