I'm currently utilizing ngRoute, and in my route controller I need to be able to call a function from the parent controller without using $scope. Here is a snippet of index.html:
<div class="col-lg-12" ng-controller="IndexController as index">
<div ng-view>
</div>
</div>
This is the parent controller:
(function(){
'use strict';
angular
.module('project')
.controller('IndexController', IndexController);
function IndexController() {
var vm = this;
vm.hello = function() {
console.log("Hello from parent controller");
}
}
})();
What's the best way for me to call the hello() function in the route controller?