That was the approach I wanted initially, but I cannot access the parent controller from template function at child directive, so the only way I could was with like this.